フィルターのクリア

How to solve simultaneous equation?

6 ビュー (過去 30 日間)
jaejin kim
jaejin kim 2020 年 10 月 7 日
コメント済み: Walter Roberson 2021 年 6 月 9 日
I hope to solve this simultaneous equation for y.
but I have some errors.
So i input the following code in Matlab R2018b:
clear all
>> syms A R B C y w t;
>> p1 = y - C*( (sin(w*t) )^2 / (A + sqrt(R*y + B^2)));
>> sol = solve([p1 == 0], y, 'ReturnConditions', true);
>> sol = solve([p1 == 0], y);
Warning: Solutions are parameterized by the symbols: z1. To include parameters and conditions in the
solution, specify the 'ReturnConditions' value as 'true'.
> In solve>warnIfParams (line 475)
In solve (line 357)
Warning: Solutions are valid under the following conditions: (signIm(A*1i - (C*sin(t*w)^2*1i)/z1) == -1 |
A*z1 == C*sin(t*w)^2 & z1 ~= 0) & C^2*sin(t*w)^4 + A^2*z1^2 == R*z1^3 + B^2*z1^2 + 2*A*C*z1*sin(t*w)^2.
To include parameters and conditions in the solution, specify the 'ReturnConditions' value as 'true'.
> In solve>warnIfParams (line 482)
In solve (line 357)
No matter what i do i can't make this to work. It's very strange. Any help will be greatly appreciated. Thanks in advance.

採用された回答

Walter Roberson
Walter Roberson 2020 年 10 月 7 日
syms A R B C y w t;
eqn = y == C*( (sin(w*t) )^2 / (A + sqrt(R*y + B^2)));
[n,d] = numden(rhs(eqn));
ysol = solve(eqn * d, y, 'maxdegree', 3)
  2 件のコメント
jaejin kim
jaejin kim 2020 年 10 月 7 日
編集済み: jaejin kim 2020 年 10 月 7 日
As you know, the solution is very complicated. I hope to get simple solution or approximation. I want to remove meaningless or really small terms.
I expect the solution is about a*sin(wt) + b*(sin(wt)^2) .
For example, A = 2.213, R = 0.736, B^2 = 0.182, C = 10, w = 2000
Isn't there a way to simply change the solution I got?
Walter Roberson
Walter Roberson 2021 年 6 月 9 日
syms A R B C y sinwt
eqn = y == C*( (sinwt )^2 / (A + sqrt(R*y + B^2)));
[n,d] = numden(rhs(eqn));
ysol = solve(eqn * d, y, 'maxdegree', 3)
ysol = 
yt = simplify(arrayfun(@(X) taylor(X, sinwt, 0, 'Order', 3), ysol))
yt = 
ytn = combine(subs(yt, {A,R,B,C}, {sym('2.213'), sym('0.736'), sqrt(sym('0.182')), sym('10.')}))
ytn = 
ytn4 = vpa(ytn)
ytn4 = 
ytn4b = mapSymType(ytn4, 'number', @(v) piecewise(imag(v) > -1e-5 & imag(v) < 1e-5, real(v), v))
ytn4b = 
ytn4c = mapSymType(ytn4b, 'number', @(v) piecewise(real(v) > -1e-5 & real(v) < 1e-5, imag(v), v))
ytn4c = 
ytn4d = vpa(ytn4c,4)
ytn4d = 
The step of taking vpa(ytn) is crucial for combining various numeric expressions that individually use numbers large enough that they cannot reasonably be ignored, but which largely "cancel out"
The two steps using mapSymType() could be combined into one step, but it would be complicated to write, like "imaginary part is more negative than this or more positive than that but real part is less negative and less positive, then select the imaginary part without the real part". In my judgement, the result would be less clear than handling the two parts independently.
I use taylor order 3 here. If you use taylor order 4, you get exactly the same result -- the taylor output is exactly the same. If you use taylor order 5 or 6 then you get a sinwt^4 term, which you indicated that you do not expect.
Note that the fact that you do not expect sinwt^4 or higher order terms, does not mean that they are not significant.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeCalculus についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by