Cannot get points on a plot to show
이전 댓글 표시
I am trying to plot N versus error and nothing shows up in the plot.
I am not getting any errors but its not plotting anything.
Any advice is appreciated, code is below.
Thanks
clear,clc;
w = pi/2;
t = 0:0.01:4;
x = t.*(0<t&t<2)+(4-t).*(2<=t&t<=4);
for N = 1:10
Ao = 1;
xhat=Ao;
for q = 1:N
xhat = xhat+(-2./((q.^(2).*pi.^(2)+N))*exp(1i*q*w*t))
xhat = xhat+(-2./((-q).^(2).*pi.^(2)+N)*exp(1i*(-q)*w*t))
end
error(N) = mean((x-xhat).^2);
plot(N,error(N));
hold all
end
채택된 답변
추가 답변 (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!