Plotting two non linear equations in same graph
4 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Sabrina Garland
el 28 de Jul. de 2023
I have following two equations
y - ((t^8 - 8*t^7 + 36*t^6 - 96*t^5 + 146*t^4 - 88*t^3 - 116*t^2 + 144*t + 81)/(t^8 - 8*t^7 + 36*t^6 - 96*t^5 + 162*t^4 - 184*t^3 + 100*t^2 - 72*t + 162))==0,
t - ((sqrt(y)*(2/3)- (sqrt(1 - y)*((3 - 2*t)/(3(2-t)))))/(sqrt(y)*(((3-t^2))/(3*(2-t))) - sqrt(1-y)*(t/3))) ==0
but I can't seem to plot it. Here's what I did -
t= linspace(0,1);
y= linspace(0.5,1);
[X, Y] = meshgrid(t, y);
f1= @(t,y)(y - ((t^8 - 8*t^7 + 36*t^6 - 96*t^5 + 146*t^4 - 88*t^3 - 116*t^2 + 144*t + 81)/(t^8 - 8*t^7 + 36*t^6 - 96*t^5 + 162*t^4 - 184*t^3 + 100*t^2 - 72*t + 162)));
f2 = @(t,y)(t - ((sqrt(y)*(2/3)- (sqrt(1 - y)*((3 - 2*t)/(3*(2-t)))))/(sqrt(y)*(((3-t^2))/(3*(2-t))) - sqrt(1-y)*(t/3))));
surf(X, Y, f1(X, Y)) ;
0 comentarios
Respuesta aceptada
Torsten
el 28 de Jul. de 2023
t= linspace(0,1);
y= linspace(0.5,1);
[T, Y] = meshgrid(t, y);
f1 = @(t,y)(y - ((t.^8 - 8*t.^7 + 36*t.^6 - 96*t.^5 + 146*t.^4 - 88*t.^3 - 116*t.^2 + 144*t + 81)./(t.^8 - 8*t.^7 + 36*t.^6 - 96*t.^5 + 162*t.^4 - 184*t.^3 + 100*t.^2 - 72*t + 162)));
f2 = @(t,y)(t - ((sqrt(y)*(2/3)- (sqrt(1 - y).*((3 - 2*t)./(3*(2-t)))))./(sqrt(y).*(((3-t.^2))./(3*(2-t))) - sqrt(1-y).*(t/3))));
surf(T,Y,f1(T,Y))
hold on
surf(T,Y,f2(T,Y))
14 comentarios
Torsten
el 30 de Jul. de 2023
Editada: Torsten
el 30 de Jul. de 2023
No. It happens at t = 1 and y = something below 1.
Or look again at the graphs here. t is abscissa and y is ordinate !
t = linspace(-3.5,3);
f1 = @(t)((t.^8 - 8*t.^7 + 36*t.^6 - 96*t.^5 + 146*t.^4 - 88*t.^3 - 116*t.^2 + 144*t + 81)./(t.^8 - 8*t.^7 + 36*t.^6 - 96*t.^5 + 162*t.^4 - 184*t.^3 + 100*t.^2 - 72*t + 162));
f2 = @(t,y)t - ((sqrt(y)*(2/3)- (sqrt(1 - y).*((3 - 2*t)./(3*(2-t)))))./(sqrt(y).*(((3-t.^2))./(3*(2-t))) - sqrt(1-y).*(t/3)));
plot(t,f1(t))
hold on
fimplicit(f2,[-3.5 3 0 1])
hold off
xlabel('t')
ylabel('y')
Más respuestas (1)
Voss
el 28 de Jul. de 2023
Use element-wise operations (.^, ./, .*)
t= linspace(0,1);
y= linspace(0.5,1);
[X, Y] = meshgrid(t, y);
f1= @(t,y)(y - ((t.^8 - 8*t.^7 + 36*t.^6 - 96*t.^5 + 146*t.^4 - 88*t.^3 - 116*t.^2 + 144*t + 81)./(t.^8 - 8*t.^7 + 36*t.^6 - 96*t.^5 + 162*t.^4 - 184*t.^3 + 100*t.^2 - 72*t + 162)));
f2 = @(t,y)(t - ((sqrt(y)*(2/3)- (sqrt(1 - y).*((3 - 2*t)./(3*(2-t)))))./(sqrt(y).*(((3-t.^2))./(3*(2-t))) - sqrt(1-y).*(t/3))));
surf(X, Y, f1(X, Y)) ;
0 comentarios
Ver también
Categorías
Más información sobre Computational Geometry en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!