I want to plot 2 functions in MATLAB.
First one is like this: X=[0.1 0.2 0.3]; Y=[5 4 1]; plot(X,Y);
and the second one that I want to plot on the last function at the same figure is $$x^{2}y+3x+4y^{2}=1$$
I really confused about that!!
Asked
Active
Viewed 132 times
1
AMIR 1996
- 75
-
You could do a contour plot: [x,y]=ndgrid([0:0.01:0.4],[0:0.1:5]);contour(x,y,x.^2.y+3x+4*y.^2,[1 1]); – Empy2 Jan 03 '16 at 10:42
1 Answers
0
If I understood correctly your problem it should be really easy. For the first plot you do:
figure
X=[0.1 0.2 0.3];
Y=[5 4 1];
plot(X,Y);
hold on % This holds the lines you have already plot
For the second plot I suggest you to explicit the function $x^{2}y+3x+4y^{2}=1$ with respect to $y$ (i.e. $y = f(x)$) then you do (after the previous commands):
plot(X,f(X))
That should solve your problem.
Of course you can put labels and titles to the plot by doing:
xlabel('the label for the x axis')
ylabel('the label for the y axis')
title('The title you want for the plot')
I hope this helped you.
desmond13
- 625