Info

此问题已关闭。 请重新打开它进行编辑或回答。

How to solve this system equation?

1 次查看(过去 30 天)
Oliver Lestrange
Oliver Lestrange 2021-1-5
关闭: Oliver Lestrange 2021-1-5
Hi,
I am trying to solve the following system. I've tried with some functions but vpasolve is the only I found out that doesn't return an error, but returns empty variables....
How can I solve this?
L = 50e-6 : 10e-6 : 200e-6;
T = 0 : 1 : 100;
dndT = 2e-4;
dLdT = 6e-6;
syms m dlambdadT
eq1 = dlambdadT == (2 .* L/m) * dndT;
eq2 = dlambdadT == (2*n/m) * dLdT;
[sol_m, sol_dlambdadT] = vpasolve([(2 .* L/m) * dndT == dlambdadT,...
dlambdadT == (2*n/m) * dLdT],[m, dlambdadT],'random',true);
Thanks in advance!
  2 个评论
John D'Errico
John D'Errico 2021-1-5
I fear that you may be confused. Certainly, you have posted a confusing question. The variable names you have chosen might indicate that you think you are trying to solve a system of ordinary DIFFERENTIAL equations. Yet nothing you have tried to use is an ODE solver.
To try to guess what you intend is nearly impossible for me.
You defined a vector T, but then you never use T as a variable.
You defined a vector L, that spans a range of numbers. You do use L later on, but not in any way that makes sense to MATLAB.
Then you define two constants, that have names that look like you think they are derivatives.
Then we see m and dlambdadT, as symbolic variables. Ok.
Two equations, named eq1 and eq2, that you don't use, but then it appears as it you try to pass the same things into vpasolve.
So, are you trying to solve this pair of equations, parametrically, as a function of L? That part seems trivial, at least at a glance. In fact, you can do it with pencil and paper. Since both equations are equal to dlambdadT, then set the right hand sides equal to each other, eliminating dlambdadT. You can recover it trivially later on.
So that leaves us with:
(2 .* L/m) * dndT == (2*n/m) * dLdT
L is known. m is an unknown. dLdT is known. But that leaves us with n. Where in the name of god and little green apples did you ever tell us what n is? You have told us dndT. Is that another hint that you think you are solving a differential equation?
Oh, yes, since we are not told the value, I have read elsewhere that n=42 is the answer to all questions.
Seriously, what you have posted as a question makes no sense at all, becasue we cannot infer what problem you really want to solve from code that is itself non-sensical and invalid.
Oliver Lestrange
Oliver Lestrange 2021-1-5
That give us no "m" each means that I can not solve the problem this way. L is variable, it is stupid solve it with pencil when I have MatLab, and I need a graph too. So MATLAB is a good way to discover with the inputs I have.
But thanks mister D'Errico.
Best regards and a happy new year

回答(0 个)

此问题已关闭。

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by