0
votes

I have the following code.

% Generate message signal

t1 = -1:0.1:1;

message_sig = rectpuls(t1);

L = length(message_sig);

figure(2)

stairs(0:L-1:L, 'linewidth',1.5);

axis([0 L -1 2]);

title('Message Signal');

When i run this, the length of my x axis is from 0 to 20. How can i reduce it to say 0 to 8, while plotting the same bit pattern. Because when i try modulating and add noise, the whole plot (noise modulated signal) is blue and needs to be zoomed alot to see accurately.

So can someone help me with a code that could solve this.

1
When I run this, my x axis goes from 0 to 7, did you forget to post some codeMZimmerman6
Oh Im sorry. I gave a different 't1' value. I've changed it now t1 = -1:0.1:1user2482542

1 Answers

1
votes

simply use xlim([0,8]), that will restrict the x-axis from going beyond 8, or edit your axis call to be axis([0,8,-1,2])

UPDATE

Assuming you have the image processing toolbox, it is really simple

in = [0,1,0];
imresize(in,[1,8],'nearest');

This will take that pattern and expand it to whatever dimension you want.