Plotting y vs x in an inseparable form
Show older comments
Hello everyone,
I have just started using MATLAB, so don't know much about it. Please help me out with the following:
I want to plot y as a function of x, x varying from 1 to 5 in some desired steps, from the following equation:
A*y^2 + B*(C+x)*y +D=0
how can I plot it, please help.
1 Comment
Ravindra Pokharia
on 13 Oct 2012
Answers (2)
Azzi Abdelmalek
on 13 Oct 2012
A=1;B=2;C=3;D=4
x=1:0.1:5;
for k=1:length(x)
v=[A B*(C+x(k)) D]
sol{k}=roots(v)
end
s=cell2mat(sol)
plot(s')
3 Comments
Ravindra Pokharia
on 14 Oct 2012
Edited: Ravindra Pokharia
on 14 Oct 2012
Azzi Abdelmalek
on 14 Oct 2012
Edited: Azzi Abdelmalek
on 14 Oct 2012
clear vout;
B=5
w=1:0.1:5;
vin=3.5*w+1.5
for k=1:length(x)
v=[1+B -2*(1+B+w(k)) 1]
vout(k,:)=roots(v)*3.5
end
plot(w,vout)
Ravindra Pokharia
on 14 Oct 2012
Walter Roberson
on 14 Oct 2012
There are two branches,
(2*(B*((Vin-3/2)^2*B-91/4+7*Vin))^(1/2)+7+(-3+2*Vin)*B)/(2+2*B)
(-2*(B*((Vin-3/2)^2*B-91/4+7*Vin))^(1/2)+7+(-3+2*Vin)*B)/(2+2*B)
The two branches combine to create real-valued parabola to the right and above Vout = 0, for that entire range of B. For B=50 and B=100 the two branches also combine to create a real-valued parabola to the left and below Vout = 0.
2 Comments
Ravindra Pokharia
on 14 Oct 2012
Walter Roberson
on 14 Oct 2012
Edited: Walter Roberson
on 14 Oct 2012
Replace the ^ with .^
I was plotting from Vin = 0; if you start from Vin = 1.5 then the left parabola I mentioned would not be present.
Categories
Find more on Surfaces and Volumes in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!