Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Can I please have help with the second part of the MatLab code for problem #4. M

ID: 2268448 • Letter: C

Question

Can I please have help with the second part of the MatLab code for problem #4. More specifically I need the Matlab code for the plot of the projection of each signal for N=5,15,50. I have attached the work for problem number 3 since it is required to do problem number 4. I have also attached to the question the Matlab code for generating the first graphs in problem #4, but im still missing the code to generate the plot of the projectin of each signal. I need help generating the Matlab code. Could it please be typed because some handwriting is really hard to understand. Thank you.

%MatLab code for first half of the graphs:

close all;
clear all;
clc;

% (a) exponential wave
T = 1;
w = 2*pi/T;
for k = 1:51
C(k) = (exp(1-1j*w*(k-1))-1)/(1-1j*w*(k-1));
end

figure;
stem(0:50,abs(C),'fill');
grid;
xlabel('k');
ylabel('Amplitude');
title('C(k)');


t = 0:0.01:5;
N = [5 15 50];

for p = 1:length(N)
for i=1:length(t)

for k = 1:N(p)
x(i,k) = C(k) * exp(1j*(k-1)*(2*pi/T)*t(i));
end
y (i) = sum(x(i,:));
end

%Plot with lables
figure;plot(t,y);grid;xlabel('Time');ylabel('Amplitude');title('Approximation');

end

% (b) square wave

% close all;
clear all;
clc;
T = 1;
w = 2*pi/T;
for k = 1:51
C(k) = (exp(-j*w*(k-1)/2)-1)^2/(2*j*w*(k-1));

end
C(1) = 0;
figure;stem(0:50,abs(C),'fill');grid;xlabel('k');ylabel('Amplitude');title('C(k)');

t = 0:0.01:5;
N = [5 15 50];

for p = 1:length(N)
for i=1:length(t)

for k = 1:N(p)
x(i,k) = C(k) * exp(1j*(k-1)*(2*pi/T)*t(i));
end
y (i) = sum(x(i,:));
end
figure;plot(t,y);grid;xlabel('Time');ylabel('Amplitude');title('Approximation');

end

Consider a Hilbert space, H, a complete orthogonal set, B, where B = {bi,b2,by, this chapter, it was shown that ) H and VBcH In ! where and the set, {, 2,3, ), is referred to as the generalized Fourier Series 3. Without using Matlab, derive an expression for the exponential Fourier series for the follow- ing signals: ft)-(-1 1 0St

Explanation / Answer

close all;
clear all;
clc;

% (a) exponential wave
T = 1;
w = 2*pi/T;
for k = 1:51
C(k) = (exp(1-1j*w*(k-1))-1)/(1-1j*w*(k-1));
end

figure;
stem(0:50,abs(C),'fill');
grid;
xlabel('k');
ylabel('Amplitude');
title('C(k)');


t = 0:0.01:5;
N = [5 15 50];

for p = 1:length(N)
for i=1:length(t)

for k = 1:N(p)
x(i,k) = C(k) * exp(1j*(k-1)*(2*pi/T)*t(i));
end
y (i) = sum(x(i,:));
end

%Plot with lables
figure;plot(t,y);grid;xlabel('Time');ylabel('Amplitude');title('Approximation');

end

% (b) square wave

% close all;
clear all;
clc;
T = 1;
w = 2*pi/T;
for k = 1:51
C(k) = (exp(-j*w*(k-1)/2)-1)^2/(2*j*w*(k-1));

end
C(1) = 0;
figure;stem(0:50,abs(C),'fill');grid;xlabel('k');ylabel('Amplitude');title('C(k)');

t = 0:0.01:5;
N = [5 15 50];

for p = 1:length(N)
for i=1:length(t)

for k = 1:N(p)
x(i,k) = C(k) * exp(1j*(k-1)*(2*pi/T)*t(i));
end
y (i) = sum(x(i,:));
end
figure;plot(t,y);grid;xlabel('Time');ylabel('Amplitude');title('Approximation');

end

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote