as I said lately about piecewise function , i have problem ?

조회 수: 2 (최근 30일)
ebi
ebi 2013년 10월 13일
댓글: ebi 2013년 10월 14일
i want to model part 2 of a paper i attach it as I said before ( i want define a piecewise function like as picture below that t is variable and we have f(t)= piecewise function and i want to plot it and do fourier illustration of this function and use fft function on it ant plot them) i do it with the help of some of mathworks member to stage of formation of piecwise and plot it on matlab
and after that i couldn't continue the procedure of my program . and had error.
please give me some information ... thanks
L=input(' define L (lenght of wagon -m) : ');
V=input(' define V (speed of train -km/h) : ');
X1=input(' define X1(distance betwean 2 wagon -m) : ');
X2=input(' define X2(distance betwean 2 middle wheels -m): ');
X=input(' define X (distance betwean 2 near wheels -m) : ');
W=input(' define W (total weight of wagon and passenger -ton) : ');
V=V*1000/3600;disp([' *** V : (speed of train)= ',num2str(V),' m/s'])
disp([' *** L : (lenght of wagon) = ',num2str(L),' m'])
disp([' *** X1: (distance betwean 2 wagon) = ',num2str(X1),' m'])
disp([' *** X2: (distance betwean 2 middle wheels) = ',num2str(X2),' m'])
disp([' *** X : (distance betwean 2 near wheels) = ',num2str(X),' m'])
disp([' *** W : (total weight of wagon) = ',num2str(W),' ton'])
F1=W*9.81/8;
disp([' *** F1: (force of 1 wheel) = ',num2str(F1),' kN'])
t1=X/V;t2=(X+X2)/V;t3=(2*X+X2)/V;t4=(2*X+X2+(L-X2-2*X)+X1)/V;
disp([' *** F1 = ',num2str(F1),' kN'])
disp([' * t1 = ',num2str(t1),' s'])
disp([' * t2 = ',num2str(t2),' s'])
disp([' * t3 = ',num2str(t3),' s'])
disp([' * t4 = ',num2str(t4),' s'])
t1 =0.0001*round(10000*t1);
t2 =0.0001*round(10000*t2);
t3 =0.0001*round(10000*t3);
t4 =0.0001*round(10000*t4);
F1 =0.0001*round(10000*F1);
t = 0:.001:t4;
F = zeros(size(t));
F((t>=0&t<=t1)) = F1;
F((t>t1&t<t2)) = 0;
F((t>=t2&t<=t3)) = F1;
F((t>=t3&t<=t4)) = 0;
plot(t,F)
figure
k=fourier(F);
plot(t,F)
figure
g=fft(F);
plot(abs(g),[0,100000])
----------------------------------- run
define L (lenght of wagon -m) : 24.5
define V (speed of train -km/h) : 270
define X1(distance betwean 2 wagon -m) : 0.6
define X2(distance betwean 2 middle wheels -m): 20
define X (distance betwean 2 near wheels -m) : 1.5
define W (total weight of wagon and passenger -ton) : 100
*** V : (speed of train)= 75 m/s
*** L : (lenght of wagon) = 24.5 m
*** X1: (distance betwean 2 wagon) = 0.6 m
*** X2: (distance betwean 2 middle wheels) = 20 m
*** X : (distance betwean 2 near wheels) = 1.5 m
*** W : (total weight of wagon) = 100 ton
*** F1: (force of 1 wheel) = 122.625 kN
*** F1 = 122.625 kN
* t1 = 0.02 s
* t2 = 0.28667 s
* t3 = 0.30667 s
* t4 = 0.33467 s
Undefined function 'fourier' for input arguments of type 'double'.
Error in Untitled (line 47)
k=fourier(F);

답변 (1개)

Walter Roberson
Walter Roberson 2013년 10월 14일
편집: Walter Roberson 2013년 10월 14일
Your F is a numeric vector. You can apply a Fast Fourier Transform (fft) or short time fft or the like to a numeric vector, but you cannot apply a full Fourier transform to a numeric vector. A full Fourier transform is something that can only be applied to symbolic expressions.
  댓글 수: 3
Walter Roberson
Walter Roberson 2013년 10월 14일
You would look back to your previous Question where I showed the symbolic form http://www.mathworks.co.uk/matlabcentral/answers/90014-how-we-can-define-piecewise-function-in-matlab#comment_173844
You can fourier() the result of the subs() that I show there. Be sure to provide the two additional parameters that the symbolic fourier routine calls for.
ebi
ebi 2013년 10월 14일
thanks a lot Mr Walter Roberson for your information.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Smoothing and Denoising에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by