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

Thread Subject:
Need help in Time Shifting of a plot....

Subject: Need help in Time Shifting of a plot....

From: Animesh Pandey

Date: 30 Jan, 2011 15:55:03

Message: 1 of 4

%%
t = -5 : 0.01 : 5;
x = (-4-(2.*t)).*(t>=-2 & t<0))
hold on
plot(t, x, 'r') %Plot of x(t)
plot(t+1, x.*3, 'c') %Plot of 3x(t+1)
grid on
hold off
%%

I am not getting the correct plot for 3x(t+1).
Could you please tell me what to do ?
Thanx....

Subject: Need help in Time Shifting of a plot....

From: ImageAnalyst

Date: 30 Jan, 2011 18:01:22

Message: 2 of 4

I think what you're looking for is
plot(t(1:end-100), x(101:end)*3, 'b');

Subject: Need help in Time Shifting of a plot....

From: Animesh Pandey

Date: 30 Jan, 2011 18:49:04

Message: 3 of 4

ImageAnalyst <imageanalyst@mailinator.com> wrote in message <db0e8e23-7a56-4ddb-8c96-abb148f68b7a@h16g2000yqh.googlegroups.com>...
> I think what you're looking for is
> plot(t(1:end-100), x(101:end)*3, 'b');
>

Thanks
Sir, I got the answer but could you please explain the syntax. !!!! ?
I haven't used anything like this before.

Subject: Need help in Time Shifting of a plot....

From: ImageAnalyst

Date: 30 Jan, 2011 21:47:06

Message: 4 of 4

end means the last element of the array in question. It has different
values depending on what array is it being used an index for. The
colon means "to" as in 1:end means go "from element 1 to element end"

Tags for this Thread

No tags are associated with this thread.

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us