Answer to Question #261658 in Electrical Engineering for Mafizur Alam

Question #261658

Generate a Cosine signal and one unit step signal using MATLAB codes

1
Expert's answer
2021-11-12T00:01:02-0500
close all,
clear all,
clc,


Fs=1000;
F = 2;
t=0:(1/Fs):1;
x = cos(2*pi*F*t);


scrsz = get(0,'ScreenSize');
Dim=0;
figure('Position',[scrsz(1)+Dim, scrsz(2)+Dim,scrsz(3)-20,scrsz(4)-100]);
subplot(2,1,1); plot(t,x); 
s =strcat('Cosine Signal at Freq. = ',32,num2str(F),32,'Hzs and Sampling Freq. Fs = ',32,num2str(Fs),32,'Hzs');
title(s,'FontSize',20);
xlabel('Time (t)');
ylabel('--- x(t) --->');
grid on,


t = -1:(1/Fs):1;
unitstep = t>=0;
subplot(2,1,2);
plot(t,unitstep)
ylim([0 2]);
s =strcat('Unit Step Signal');
title(s,'FontSize',20);
xlabel('Time (t)');
ylabel('--- x(t) --->');
grid on,




Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS