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

David Young
David Young 2011년 8월 17일
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.

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

답변 (0개)

카테고리

도움말 센터File Exchange에서 MATLAB에 대해 자세히 알아보기

태그

질문:

2011년 8월 17일

Community Treasure Hunt

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

Start Hunting!

Translated by