Symbolic equation simplification output, such as x/y from two equations
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
I was working with matlab symbolics, and was doing this pipe flow example from a text book (Chin Fluid Mechanics, Q4.13 pg 329)
I got it out by hand, but decided to do it in MATLAB.
The code below works fine, but I have a question on how to get the output in a more concise command for the U_o/u_max ratio directly rather than have to know that it is divided by u_max
syms u(r) r u_max R U_o
u(r) = u_max*(1-r/R)^(1/7)
Q(r) = 2*pi*u(r)*r
Q_out = int(Q(r),r,0,R)
Q_in = pi*R^2*U_o
(isolate(Q_in==Q_out,U_o)/u_max)
Is there a way to get MATLAB to give the output in terms of U_o/u_max directly from some function such as from the Formula Manipulation and Simplification from the Formula Rearrangement and Rewriting on MATLAB help Formula Manipulation and Simplification - MATLAB & Simulink - MathWorks United Kingdom
Looking under Rewriting & Decomposition, I don't see a function that does this directly.
0 Kommentare
Antworten (1)
John D'Errico
am 18 Okt. 2022
Bearbeitet: John D'Errico
am 18 Okt. 2022
If you don't know what umax is, where would it go? What do you hope to see here as a result? You are computing the ratio, u0/umax. Correct? Is that not what you got?
You can always call it something else. Feel free to pick a name, anything you want. Maybe uratio. So at the end, you might do this...
syms U_ratio
subs((isolate(Q_in==Q_out,U_o)/u_max),U_o/U_max,U_ratio)
But what function would you expect would do that for in some automatic way, thus know what you want to see, and produce the result it thinks would make you happy? If it could do that much, you would tell it to read the book, and do the exercises and examples for you. Of course then, you would not need to tell it to read the book, since it could write the book itself. You may see where this is all going to end badly for us. That would be a computer I'd be very worried to see. ;-)
2 Kommentare
John D'Errico
am 22 Okt. 2022
As I said, you can simply substitute for U_o/U_max at the end. Or you could do it at some earlier point, thus representing the problem in terms of a different variable, perhaps called U_ratio = U_0/U_max. Then you would just solve for U_ratio.
Siehe auch
Kategorien
Mehr zu Assumptions finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!