Error using plot Data must be numeric, datetime, duration or an array convertible to double.
이전 댓글 표시
This is my code
N=[randi([1,5],1,2),randi([10,50],1,2),randi([100,500],1,2)];
t=[-10:0.01:10];
tau=2*pi/3
for i=1:length(N)
phi = exponential(N(i),t,tau);
subplot(3,1,i)
plot(t, phi,'b-')
end
% and here's my code for the functions
function phi = exponential(N,t,tau)
syms t
w=1;
for i = 1:length(tau)
T = tau(i)
f = (1)
do = (1/(2*pi)) * int(f,t,-T/2,T/2);
doz = double(do)
d0vec(i)=doz
end
for i=1:length(N)
for n=1:N(i)
fun = 1*exp(N*t*w*j);
dn = (1/(2*pi))*int(f*cos(n*pi*t),t,-T/2,T/2);
ddn = double(dn);
dnz(n) = ddn;
end
dnhar{i} = dnz;
end
for i=1:length(N)
ef = 0;
for n=1:N(i)
estf=((dnhar{i}(n))*exp(j*w*N*t));
ef = ef+estf
end
ftarray = ef+doz
end
phi = eval(ftarray);
end
I am supposed to calculate and graph the nth term of fourier exponential series.
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 2-D and 3-D Plots에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!