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:
substitude for "length"

Subject: substitude for "length"

From: Danna

Date: 27 Jul, 2010 05:26:04

Message: 1 of 5

how can i substitude length in this code, I tried with i=-2*pi:0.01:2*pi; but it doesnt work

t=-2*pi:0.01:2*pi;
x=10*2+(cos(t));
y = sin(10*t);
for i=1:length(t)
hold on
plot(x(i),y(i),'*m')
axis([19 21 -1 1])
pause(.01)
end

Subject: substitude for "length"

From: Gautham Prasad

Date: 27 Jul, 2010 06:02:08

Message: 2 of 5

"Danna " <silver_girl@hotmail.com> wrote in message <i2lqlc$oll$1@fred.mathworks.com>...
> how can i substitude length in this code, I tried with i=-2*pi:0.01:2*pi; but it doesnt work
>
> t=-2*pi:0.01:2*pi;
> x=10*2+(cos(t));
> y = sin(10*t);
> for i=1:length(t)
> hold on
> plot(x(i),y(i),'*m')
> axis([19 21 -1 1])
> pause(.01)
> end


ya what u did wont work for sure.
the length is (upper limit - lower limit)/step.
so in this case its, 4*pi/0.01

Subject: substitude for "length"

From: Gautham Prasad

Date: 27 Jul, 2010 06:03:07

Message: 3 of 5

"Danna " <silver_girl@hotmail.com> wrote in message <i2lqlc$oll$1@fred.mathworks.com>...
> how can i substitude length in this code, I tried with i=-2*pi:0.01:2*pi; but it doesnt work
>
> t=-2*pi:0.01:2*pi;
> x=10*2+(cos(t));
> y = sin(10*t);
> for i=1:length(t)
> hold on
> plot(x(i),y(i),'*m')
> axis([19 21 -1 1])
> pause(.01)
> end


replace length(t) by the formula :
(upper limit - lower limit) / step.
in this case it is, 4*pi/0.01

regards,
gautham

Subject: substitude for "length"

From: Steven_Lord

Date: 27 Jul, 2010 14:23:24

Message: 4 of 5



"Danna " <silver_girl@hotmail.com> wrote in message
news:i2lqlc$oll$1@fred.mathworks.com...
> how can i substitude length in this code,

Substitute length with _what_?

> I tried with i=-2*pi:0.01:2*pi; but it doesnt work
>
> t=-2*pi:0.01:2*pi;
> x=10*2+(cos(t));
> y = sin(10*t);
> for i=1:length(t)
> hold on
> plot(x(i),y(i),'*m')
> axis([19 21 -1 1])
> pause(.01)
> end

--
Steve Lord
slord@mathworks.com
comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
To contact Technical Support use the Contact Us link on
http://www.mathworks.com

Subject: substitude for "length"

From: Danna

Date: 27 Jul, 2010 23:14:05

Message: 5 of 5

"Steven_Lord" <slord@mathworks.com> wrote in message <i2mq4s$es$1@fred.mathworks.com>...
>
>
> "Danna " <silver_girl@hotmail.com> wrote in message
> news:i2lqlc$oll$1@fred.mathworks.com...
> > how can i substitude length in this code,
>
> Substitute length with _what_?
>
> > I tried with i=-2*pi:0.01:2*pi; but it doesnt work
> >
> > t=-2*pi:0.01:2*pi;
> > x=10*2+(cos(t));
> > y = sin(10*t);
> > for i=1:length(t)
> > hold on
> > plot(x(i),y(i),'*m')
> > axis([19 21 -1 1])
> > pause(.01)
> > end
>
> --
> Steve Lord
> slord@mathworks.com
> comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
> To contact Technical Support use the Contact Us link on
> http://www.mathworks.com

thank you!!!

Tags for 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