I'm new to Matlab and I'm completely lost with one of the programs that was assigned to me, please help!

Here is the link to the program/assignment, someone please help.
I don't want the answer, I just need assistance on how to do this because I don't even know how to start.

댓글 수: 2

The last sentence is such important, that I vote for this question. I've moved it from the comments to the question.

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

 채택된 답변

hi, Your program has :
Inputs : Half period L and number of iterations N .
Outputs : A vector that approximates a square wave .
L=2; % Half Period .
N=9; % Number of iterations
f=0; % Output .
T=l.......(0,2*L,500) %Incomplete line, A Mat function that creates linearly spaced vectors , it starts with lin...
for n=1:2:N
f=f+(4/(n*pi))*sin(n*pi*T/L); % Fourier series
end
figure, plot(T,f)
In the loop , after each iteration (4/(n*pi))*sin(n*pi*T/L) is added to (4/((n-1)*pi))*sin((n-1)*pi*T/L), and so on...
what is left :
1) Prompts for inputs L and N .
2) check if N is odd and L is >0 otherwise use function "error" .
3) Increase the number of iterations .

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Loops and Conditional Statements에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by