Fourier series

how to write summation equation in matlab? can i write n ths way?
function [z1,z2,z3,z4,z5]=switching1(x)
fprintf('enter the value of ');
n=input('n');
for i=1:n
z(1)=1-[(2/pi)*symsum((-1)^i(x(i)-(sin(2*x(i))/2))),1,n]
z(n)=(2/pi)*[symsum((sin*(n-1)*x(i))/(n-1)-(sin*(n+1)*x(i))/(n+1)),1,n]
end
z=(z1-0.2)^2+[z(n)]^2;

1 comentario

David Young
David Young el 17 de Ag. de 2011
Your question seems to reveal many misconceptions, and I think you would do well to review the documentation relating to arrays and matrices in MATLAB before trying to fix this code - go through the introductory material in the users' guide. Note in particular that z(1) is not the same as z1.

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre MATLAB en Centro de ayuda y File Exchange.

Etiquetas

Preguntada:

el 17 de Ag. de 2011

Community Treasure Hunt

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

Start Hunting!

Translated by