Cannot get points on a plot to show
Mostrar comentarios más antiguos
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
Respuesta aceptada
Más respuestas (0)
Categorías
Más información sobre 2-D and 3-D Plots en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!