finding values of implicit function of 3d
1 view (last 30 days)
Show older comments
This question was flagged by Star Strider
If t and x are independent variables and u(t,x) dependent variable. how can I calculate u(t,x) at different positions of t and x for implicit function
b^{u(t,x)}*[ux/e*u(t,x)]^{vt/2}=b^{x/2}. t and x both are vectors.
where
nx=2; nt=3;
a=0; b=10; T=3; %in sec 3 min or 180 sec
x=linspace(a,b,nx+1)
t=linspace(0,T,nt+1)
u=zeros(nt+1,nx+1)
b=10
v=70
ux=90
e=exp(1)
3 Comments
John D'Errico
on 8 Jan 2023
Edited: John D'Errico
on 8 Jan 2023
Was it really necessary to ask the same question TWICE? Were you in that much of a hurry? And you got an answer to your first question. Were it not that my solution uses solve instead of the alternative approaches shown, I would delete my answer and close this question. I may still do so.
Please do not ask this question a third time. If you are confused at the answer, write a comment explaining why you are confused, and ask for further explanation.
Answers (1)
John D'Errico
on 8 Jan 2023
Edited: John D'Errico
on 8 Jan 2023
So you have the relation:
a=0; b=10; T=3;
e = exp(1);
ux = 90;
v = 70;
syms u t x
b^u*(ux/e*u)^(v*t/2) == b^(x/2)
(Please learn to use MATLAB syntax, rather than sprinking various type of parens and braces through an expression.) Even with that, I had to guess in several places what you actually intended.
I am not terribly sure if this sub-expression
[ux/e*u(t,x)]
is actually intended to mean
[ux/e*u(t,x)]
or
[ux / (e*u(t,x)) ]
That is, is u(t,x) in the numerator there, or the denominator? Im not really sure, so I'll assume you intended what you actually wrote.
I'll also assume that vt is just v*t, not another undefined variable.
Regardless, solve from the symbolic toolbox should be able to handle this, but it seems to get stuck. You have many powers of 10 in there, so suppose I take the log base 10 of each side? That will reduce to
u + log10(ux/e*u)*(35*t) == x/2
usol = solve(u + log10(ux/e*u)*(35*t) == x/2,u)
The script w in there is the Wright-omega function. It always appears in this kind of problem. As well, see that when MATLAB just writes log, it means the NATURAL log, not log to the base 10.
help sym/wrightOmega
Again, this requires I have interpreted your original expression properly. But there is a solution in any case.
You can evaluate that expresion as a function of t and x now.
u_tx = matlabFunction(usol)
u_tx(T/2,(a+b)/2) % in the middle of the range for t and x
fsurf(u_tx,[0 T a b])
xlabel t
ylabel x
zlabel u
Note that this solution probably returns only one branch of the solution. Like a sqrt, there would probably be at least one other branch, as shown in the alternative soltuiions you got the other time you asked this question.
If you now wish to evaluate the function at a grid of points for t and x, you can easily do so now. As you can see, I just plotted the surface. Again, note that this is only the primary solution to a problem where the solution may not be unique.
0 Comments
See Also
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!