modulating the meesage signal

Asked by yofiandi yosmansyah

yofiandi yosmansyah (view profile)

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

yofiandi yosmansyah

yofiandi yosmansyah (view profile)

on 11 Jan 2013

oke..im 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 }

yofiandi yosmansyah

yofiandi yosmansyah (view profile)

on 11 Jan 2013

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

Walter Roberson

Walter Roberson (view profile)

on 11 Jan 2013

stairs() to plot.

Walter Roberson (view profile)

Answer by Walter Roberson

Walter Roberson (view profile)

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.

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

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

New to MATLAB?

Learn MATLAB today!