MATLAB Answers

modulating the meesage signal

Asked by yofiandi yosmansyah on 10 Jan 2013

hi guys i have a question which is how to write the matlab code for a messages signal

m(t) = 
1 when 0=<t=<0.05
-9 when 0.05=<t=<0.1
else is 0 

pls help me and thanks

  15 Comments sorry i was very sleep so i didnt see it clearly.. well the m(t) became 2 from t= 0 until t=0.05 and become -9from t=0.05 onward. but when t<0 and t>0.1 its supposed have a zero value. so how to make that m(t) yah? m(t) = { 1 when 0=<t=<0.05 -9 when 0.05=<t=<0.1 0 when t= elsewhere }

thats it is..thanks bro for the help..i really appreciate it..btw how to plot the amplitude spectra ya??

stairs() to plot.

Log in to comment.


No products are associated with this question.

1 Answer

Answer by Walter Roberson
on 11 Jan 2013

Define your vector t of times. Then,

m = zeros(size(t));
m(t > 0 & t < 0.05) = 1;
m(t >= 0.05 & t <= 0.01) = -9;

Note this would be only one pulse.


Log in to comment.

Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

MATLAB Academy

New to MATLAB?

Learn MATLAB today!