The new Dn = j (((1)n) / n) for n--N:N if n-0, Dn (i)-sin(n)/(n*pi); else, Dn (i
ID: 3591129 • Letter: T
Question
The new Dn = j (((1)n) / n)
for n--N:N if n-0, Dn (i)-sin(n)/(n*pi); else, Dn (i)-1/pi; end; end; 1. To turn in (a) Explain why the line i-n+N+1 is needed in the above code. Why can't we use n as the index to Dn? (b) Modify the for loop for the formula we calculated for Example C on slide 69 of Lecture Notes Set 3. Turn in your code and the result of evaluating fsgen (3) at the command line. (c) Create a second program that implements this without a for loop. (Hint Matlab will not return an error when you divide by zero, so you can fix the indefinite terms after computing the rest.) Turn in your code and the result of evaluating fsgen (3) at the command line.Explanation / Answer
we cannot use the n because the Dn is the Wimplicit function and it should be declared before the Dn declartion.
b)
fsgen can be used to replace the looping of the system
where the n~=0 then the Dn(i)=0
else, the result be Dn(i)=0.318
for n=-N:N
i=n+N+1;
if n~=0,
Dn(i)=1/pi;
else,
Dn(i)=sin(n)/(n*pi);
fsgen(Dn(i));
end;
end;
c)
for n=-N:N
i=n+N+1;
if n~=0,
Dn(i)=sin(n)/(n*pi);
else,
Dn(i)=1/pi;
Dn = j (((1)n) / n)
fsgen(Dn);
end;
end;
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.