BumbleBee09
Newbie level 1
Hi all,
I have just started out with my signals and systems course and as an exercise I am trying to do visualise the sampling theorem on MATLAB Hence I need to do something as simple as multiplying a continous signal with an impulse train. I am struggling to write the code . Please help me!!
I can plot the sine/cosine signal and the impulse train separately but cannot multiply them
% Cosine from -pi to pi
t1 = linspace(0, 6 , 1000);
x = cos( 2* pi * t);
%Impulse train
t2 = linspace ( 0,6,7 );
train = ones(1,t2);
% sampledsig = x.*train;
Now when I try to multiply them , I am always getting an error which is obvious since the vector size is different . Any help is greatly appreciated .
Thanks & Regards
I have just started out with my signals and systems course and as an exercise I am trying to do visualise the sampling theorem on MATLAB Hence I need to do something as simple as multiplying a continous signal with an impulse train. I am struggling to write the code . Please help me!!
I can plot the sine/cosine signal and the impulse train separately but cannot multiply them
% Cosine from -pi to pi
t1 = linspace(0, 6 , 1000);
x = cos( 2* pi * t);
%Impulse train
t2 = linspace ( 0,6,7 );
train = ones(1,t2);
% sampledsig = x.*train;
Now when I try to multiply them , I am always getting an error which is obvious since the vector size is different . Any help is greatly appreciated .
Thanks & Regards