Plot multiple graph after solving
Ahora está siguiendo esta pregunta
- Verá actualizaciones en las notificaciones de contenido en seguimiento.
- Podrá recibir correos electrónicos, en función de las preferencias de comunicación que haya establecido.
Se ha producido un error
No se puede completar la acción debido a los cambios realizados en la página. Vuelva a cargar la página para ver el estado actualizado.
0 votos
Comparte un enlace a esta pregunta
I have following two equations -
f1 = -2*g*t.^3/((1 - y).^(1-2*g)) + 2*g*(3 - t.^2)^2./((2 - t).*y.^(1-2*g)) + (8*g*t)./(y.^(1-2*g)) - 2*g*(3 - 2*t).^2./((2 - t).*(1 - y).^(1-2*g));
f2 = t - (((y.^(2*g))*(2/3) - (((1-y).^(2*g)).*((3 - 2*t)./(3*(2-t)))))./((y.^(2*g)).*(((3-t.^2))./(3*(2-t))) - ((1-y).^(2*g)).*(t/3)));For every g in the range (0,0.114), solving the two equations above give two solution - y with t=1 and y with a t between 0.5 and 1. (it also give solution with negative y and t less than 0.5, I am not interested in them). To give a sense, for g=0.11 I get following solution - t=1 ^ y=0.85536 t=0.9873 ^ y=0.85530.
I want Matlab to plot two graph (on same plot) with g on x axis and y values in y axis. One graph should have y values for t=1 and one graph should have y values for t in range 0.5 to 1 (below 1).
Since I have done numerical simulation with random values, I know graph should look the following (attached rough sketch)
I don't know how to ask Matlab to pick the specific ans and then plot them. Shall I create a loop?
5 comentarios
Comparte un enlace a este comentario
Comparte un enlace a este comentario
Comparte un enlace a este comentario
Comparte un enlace a este comentario
Comparte un enlace a este comentario
Respuesta aceptada
1 voto
Comparte un enlace a esta respuesta

22 comentarios
Comparte un enlace a este comentario
Comparte un enlace a este comentario
Comparte un enlace a este comentario
Comparte un enlace a este comentario
Comparte un enlace a este comentario
Comparte un enlace a este comentario
Comparte un enlace a este comentario
Comparte un enlace a este comentario
Comparte un enlace a este comentario
Comparte un enlace a este comentario

Comparte un enlace a este comentario
Thank you @Torsten. One last question. If I have to go one step ahead and want Matlab to substitute the pair of solution [that I got by solving f1 and f2 for each g in range 0.01 to 0.12) with (t=1 with associated y) and (t<1 with associated y) into following function -
f4 = (((3-t^2)^2)*(y^(2 g))+ ((3 - 2 t)^2)*(1 - k)^(2 g))/(18 (2 - t)) + (1/18) (4 t (k^(2 g)) + t^3 ((1 - k)^(2 g)))
And generate me two curves - one with solution of above function when t=1 and other when t<1 against g on x axis. How can I do it.
Help @Torsten
Comparte un enlace a este comentario
Comparte un enlace a este comentario
f4 is not 0. f4 is just a function of t and y and I want the value of this function at Solution of t and y. f4 is an objective function.
f4 = (((3-t^2)^2)*(y^(2*g))+ ((3 - 2*t)^2)*(1 - k)^(2*g))/(18*(2 - t)) + (1/18)*(4*t*(k^(2*g)) + (t^3)*((1 - k)^(2*g)))
I want to plot the value of objective function against g - two separate lines: one at t=1, other at t<1. Please help @Torsten
Comparte un enlace a este comentario
Comparte un enlace a este comentario

Comparte un enlace a este comentario
Why I am getting this error -
Error using arrayfun All of the input arguments must be of the same size and shape. Previous inputs had size 118 in dimension 2. Input #3 has size 111
And I am really sorry - there is no k in f4, it is y. It is my typo.
f4 = (((3-t.^2).^2).*(y.^(2*g))+ ((3 - 2*t).^2).*(1 - y).^(2*g))./(18*(2 - t)) + (1/18)*(4*t.*(y.^(2*g)) + (t.^3).*((1 - y).^(2*g)));
Please help @Torsten
Comparte un enlace a este comentario
Comparte un enlace a este comentario
Comparte un enlace a este comentario
Comparte un enlace a este comentario
Comparte un enlace a este comentario
Comparte un enlace a este comentario
Más respuestas (1)
1 voto
Comparte un enlace a esta respuesta
Categorías
Más información sobre Upgrading Hydraulic Models to Use Isothermal Liquid Blocks en Centro de ayuda y File Exchange.
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Seleccione un país/idioma
Seleccione un país/idioma para obtener contenido traducido, si está disponible, y ver eventos y ofertas de productos y servicios locales. Según su ubicación geográfica, recomendamos que seleccione: .
También puede seleccionar uno de estos países/idiomas:
Cómo obtener el mejor rendimiento
Seleccione China (en idioma chino o inglés) para obtener el mejor rendimiento. Los sitios web de otros países no están optimizados para ser accedidos desde su ubicación geográfica.
América
- América Latina (Español)
- Canada (English)
- United States (English)
Europa
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
