# main23 - ( interpolated = (ff_eval(0:pi/7:2*pi)) %function...

This preview shows pages 1–2. Sign up to view the full content.

% % Derek Rampal % HW23 % clear; c % Problem 1 % N = 15 % data1 = [0 6 12 18 24 30 36 42 48 54 60 66 72 78 84 124 134 148 156 147 133 121 109 99 85 78 89 104 116 124]; [m1,n1] = size(data1); [ % trap sum = 0; for i = 1:n1-1 sum = sum + 6*(data1(2,i)+data1(2,i+1))/2; end; length_trap = sum average_velocity_trap = sum/84 a %spline S = cubic_spline_get_coeffs(data1(1,:),data1(2,:)); Sint = splineint(S); [m2,n2] = size(Sint); [ sum1=0; for i = 1:m2 sum1 = sum1 + Sint(i,:)*[6^4; 6^3; 6^2; 6]; end; length_spline = sum1 average_velocity_spline = sum1/84 a %trig poly data1 = [0 6 12 18 24 30 36 42 48 54 60 66 72 78 124 134 148 156 147 133 121 109 99 85 78 89 104 116]; z1 = fft(data1(2,:),length(data1(2,:))); z ff_eval = @(x) real(fft_evaluate(z1,x)); (data1(2,:)); %To compare estimated to determine if function is executing

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ( interpolated = (ff_eval(0:pi/7:2*pi)) %function is executing length_fourier = 42/pi*quad(ff_eval,0,2*pi) avg_velocity_fourier = 1/(84) * length_fourier a % Problem 2 % data = [0.0000 0.0006 0.0038 0.0079 0.0069 -0.0045 -0.0250 -0.0440 -0.0457 -0.0193 0.0309 0.0837 0.1093 0.0854 0.0126 -0.0816 -0.1529 -0.1622 -0.0971 0.0189 0.1346 0.1960 0.1724 0.0731 -0.0570 -0.1588 -0.1880 -0.1359 -0.0313 0.0751 0.1369 0.1333 0.0759 -0.0010 -0.0603 -0.0805 0.0626 -0.0252 0.0088 0.0252 0.0234 0.0123 0.0023 -0.0015 -0.0008];-[m,n] = size(data); z = fft(data,n); power_spectrum = z.*conj(z) [a,b]=sort(power_spectrum,'descend'); [m,n]=size(b); b=b-ones(m,n); three_dom_freqs = b(m,1:2:5)/(2*pi)...
View Full Document

## This note was uploaded on 09/19/2009 for the course MATH numerical taught by Professor Ford during the Spring '09 term at FAU.

### Page1 / 2

main23 - ( interpolated = (ff_eval(0:pi/7:2*pi)) %function...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online