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:
draw function

Subject: draw function

From: Cetver Cetver

Date: 16 Dec, 2008 10:35:03

Message: 1 of 3

Hello all.

xy.m :
function [x,y] = xy(t)
x = t^2-2*cos(t);
y = 1-sin(t);

draw.m:
function draw(n,s);
figure(n);
xlabel('X')
ylabel('Y')
fplot('xy',s)

>> draw(1,1)
??? Attempted to access lims(:,1); index out of bounds because numel(lims)=1.

Error in ==> fplot at 96
xmin = min(lims(1:2)); xmax = max(lims(1:2));

Error in ==> draw at 6
fplot('xy',s)

function draw must draw a graphik with 2 parametrs where
n - figure's nuber
s - function step

Subject: draw function

From: Dave Brackett

Date: 16 Dec, 2008 13:35:03

Message: 2 of 3

"Cetver Cetver" <wwww@www.com> wrote in message <gi808n$ps4$1@fred.mathworks.com>...
> Hello all.
>
> xy.m :
> function [x,y] = xy(t)
> x = t^2-2*cos(t);
> y = 1-sin(t);
>
> draw.m:
> function draw(n,s);
> figure(n);
> xlabel('X')
> ylabel('Y')
> fplot('xy',s)
>
> >> draw(1,1)
> ??? Attempted to access lims(:,1); index out of bounds because numel(lims)=1.
>
> Error in ==> fplot at 96
> xmin = min(lims(1:2)); xmax = max(lims(1:2));
>
> Error in ==> draw at 6
> fplot('xy',s)
>
> function draw must draw a graphik with 2 parametrs where
> n - figure's nuber
> s - function step

help fplot
you haven't specified your function or limits correctly in the fplot line. also, when is t defined?

Subject: draw function

From: Steven Lord

Date: 16 Dec, 2008 14:18:00

Message: 3 of 3


"Cetver Cetver" <wwww@www.com> wrote in message
news:gi808n$ps4$1@fred.mathworks.com...
> Hello all.
>
> xy.m :
> function [x,y] = xy(t)
> x = t^2-2*cos(t);
> y = 1-sin(t);
>
> draw.m:
> function draw(n,s);
> figure(n);
> xlabel('X')
> ylabel('Y')
> fplot('xy',s)
>
>>> draw(1,1)
> ??? Attempted to access lims(:,1); index out of bounds because
> numel(lims)=1.

That error message is misleading; I'll note that to the appropriate
developers.

> Error in ==> fplot at 96
> xmin = min(lims(1:2)); xmax = max(lims(1:2));

Note that the way you call DRAW, s is just the number 1. What does FPLOT
expect its second input to be? [Take a look at "help fplot" if you're not
sure.]

You need to specify a vector of limits as the second input to your DRAW
call. Then DRAW will pass that vector of limits along to FPLOT.

--
Steve Lord
slord@mathworks.com

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