MATLAB CODE TO GENERATE A EXP. & SINE SIGNAL

CODE:


clc; %clears all input and output from the Command Window display
clear all;            %removes all variables from the workspace
close all;            %deletes the current figure or the specified figure(s)
x=input('enter the value of x:');
y=exp(x);             %exponatial function
subplot(2,1,1);       %divides the current figure into numbered rowwise
stem(y);              %Plot discrete sequence data

title('Exponential');
xlabel('Time');       %give label to x axies
ylabel('Amplitude');
p=0:0.1:2*pi;         %vary the value
z=sin(p);
subplot(2,1,2);
stem(z);
title('Sine Wave');    %Add title to current axes
xlabel('Time');
ylabel('Amplitude');
 


OUTPUT:


enter the value of x:1:10


0 comments:

Post a Comment