NEED HELP on MatLab ezplot and feval functions
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
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
0
Comments
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));