Generation of elementary signals using MATLAB code
clc;
clear all;
close all;
t=input('Enter the value of time');
f=input('Enter the value of frequency');
w=2*pi*f;
%%sinusoidal wave
y=sin(w*t);
plot(t,y);
xlabel('time');
ylabel('Amplitude');
title('sinusoidal wave');
grid on
%Exponential/Damped wave
y=exp(-0.09*t).*sin(w*t+3);
figure
plot(t,y);
xlabel('time');
ylabel('Amplitude');
title('Exponential/Damped wave');
grid on
%%Discrete exponential wave
y=exp(-0.4*t);
figure
stem(t,y);
xlabel('time');
ylabel('Amplitude');
title('Exponentialsample wave');
grid on
%%Two Exponential Curves
y1=exp(-0.4*t);
y2=exp(0.4*t);
figure
plot(t,y1,'r',t,y2,'g');
xlabel('time');
ylabel('Amplitude');
title('Two Exponential wave');
grid on
%%Two Exponential Curves including different symbols
y1=exp(-0.9*t);
y2=exp(0.9*t);
figure
plot(t,y1,'rd',t,y2,'g>');
xlabel('time');
ylabel('Amplitude');
title(' Two Exponential curves including different symbols
');
grid on
%%'Negative Exp','positive
y1=exp(-0.9*t);
y2=exp(0.9*t);
figure
plot(t,y1,'kd',t,y2,'k>');
xlabel('time');
ylabel('Amplitude');
title('Exponential curve');
grid on;
legend('negative Exp','positive Exp')
%%sinc function
y=sinc(w*t);
figure
plot(t,y);
xlabel('time');
ylabel('Amplitude');
title('sinusoidal wave');
grid on;
Result:
Enter the value of time-pi:0.01:2*pi;
Enter the value of frequency1
Result:
Enter the value of time-pi:0.01:2*pi;
Enter the value of frequency1
Result:
Enter the value of time0:.1:1
Enter the value of frequency1
Result: Enter the value of time0:.1:3
Enter the value of frequency100
Result:
Enter the value of time0:.1:1
Enter the value of frequency10
Result: Enter the value of time0:.1:1
Enter the value of frequency10
Result:
Enter the value of time-pi:0.01:2*pi
Enter the value of frequency1
No comments