NEED HELP on MatLab ezplot and feval functions

edited September 2006 in Science & Tech
Hello!

I am wanting to plot multiple circles on the same axes.
If I physically type the following:

hold on
ezplot('x^2+y^2-4)
ezplot('x^2+y^2-9)
ezplot('x^2+y^2-16)

and so on, then I can achieve the desired result.

The thing is that I have a varying number of circles I need to plot. So, I want to write a loop that utilizes the "radius matrix"

For example,

radii=[1,2,3,4,5,6,7,8,9,10];
for i=1:10
ezplot('x^2+y^2-radii(i)');
end

but, this doesn't work because radii isn't a character function.

I think utilizing the feval function might fix the problem, but I am at a loss of how to do so. ANY help would be greatly appreciated! Thank you!!

-gonavy0806

Comments

  • shwaipshwaip bluffin' with my muffin Icrontian
    edited September 2006
    int2str(n) return the string version of int n.

    soooo

    ezplot( strcat('x^2 + y^2 - ', int2str(radii(i))));

    or
    ezplot();

    or however you like to concat strings.

    edit:

    and, this may even work:
    ezplot('x^2 + y^2 -' + radii(i));
  • LeonardoLeonardo Wake up and smell the glaciers Eagle River, Alaska Icrontian
    edited September 2006
    Well, that's what I would have said! Maybe...:scratch::eek3:
  • shwaipshwaip bluffin' with my muffin Icrontian
    edited September 2006
    It's really quite simple once you understand the deeper workings of the universe.
Sign In or Register to comment.