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

I want to Re-write the below Mat lab code but in frequency domain: %time domain

ID: 2081193 • Letter: I

Question

I want to Re-write the below Mat lab code but in frequency domain:

%time domain

t=0:0.001:10;

m=a*sin(2*pi*1*t);

c=b*sin(2*pi*1*t);

y=((1+m).*c);

subplot(4,1,1)

plot(t,y)

title('figure 1 ');

t=0:0.001:10;

a=0.5;

b=1;

m=a*sin(2*pi*0.5*t);

c=b*sin(2*pi*10*t);

y=((1+m).*c);

subplot(4,1,2)

plot(t,y)

title('figure 2 ');

t=0:0.001:10;

a=1;

b=1;

m=a*sin(2*pi*0.5*t);

c=b*sin(2*pi*10*t);

y=((1+m).*c);

subplot(4,1,3)

plot(t,y)

title('figure 3 ');

t=0:0.001:10;

a=2;

b=1;

m=a*sin(2*pi*0.5*t);

c=b*sin(2*pi*10*t);

y=((1+m).*c);

subplot(4,1,4)

plot(t,y);

title('figure 4 ');

Explanation / Answer

%time domain
t=0:0.001:10;
a=0.5; % since this wasnt mentioned in the original code, I have assumes certain values
b=1; % also not mentioned in the code
m=a*sin(2*pi*1*t); %1 Hz
c=b*sin(2*pi*1*t); % 1 Hz
y=((1+m).*c); % 1Hz signal and 2 Hz signal
y_freq1=fft(y);
subplot(4,1,1)
plot(t,y)
title('figure 1 ');
t=0:0.001:10;
a=0.5;
b=1;
m=a*sin(2*pi*0.5*t);
c=b*sin(2*pi*10*t);
y=((1+m).*c);
y_freq2=fft(y);
subplot(4,1,2)
plot(t,y)
title('figure 2 ');
t=0:0.001:10;
a=1;
b=1;
m=a*sin(2*pi*0.5*t);
c=b*sin(2*pi*10*t);
y=((1+m).*c);
y_freq3=fft(y);
subplot(4,1,3)
plot(t,y)
title('figure 3 ');
t=0:0.001:10;
datapoints = length(t);
a=2;
b=1;
m=a*sin(2*pi*0.5*t);
c=b*sin(2*pi*10*t);
y=((1+m).*c);
y_freq4=fft(y, datapoints)/datapoints;
fs=datapoints/10;
f = fs/2*linspace(0,1,datapoints/2+1);
subplot(4,1,4)
plot(t,y);
title('figure 4 ');
figure;
subplot(4,1,1)
plot(f,2*abs(y_freq1(1:datapoints/2+1)));
title('figure 1 ');
subplot(4,1,2)
plot(f,2*abs(y_freq2(1:datapoints/2+1)));
title('figure 2 ');
subplot(4,1,3)
plot(f,2*abs(y_freq3(1:datapoints/2+1)));
title('figure 3 ');
subplot(4,1,4)
plot(f,2*abs(y_freq4(1:datapoints/2+1)));
title('figure 4 ');

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