How to solve the below equation for x and plot the values of x with respect to y and z where y varies from 100 - 500 and z varies from 200-600.
H = x*exp((3*x*y/sin(x))* z) + cos(2*x*z/y) + exp(-0.5*x);
%%I tried the below
syms x;
z = poles(H, x, 0, 3);
%%Not working for me

 採用された回答

John D'Errico
John D'Errico 2022 年 2 月 26 日

1 投票

So for any given value of H, y, znd z, you want to be able to write x as a function of them, then drawing a nice pretty picture.
It is trivially easy to write an expression that has no analytical solution. This is probably one of them, with x falling both inside and outside the exponentials, as well as a trig function. Worse, it may almost certainly be the case where there are mutliple solutions. Trig functions always create those situations.
Finally, you will have the problem that if such a relationship did exist, it would be a function of THREE variables, H,y,z. Unless perhaps you mean that H is supposed to be zero. But if H is some general parameter, then the plot you would generate would be a 4-dimensional plot, difficult to view on your monitor.
If you want to plot the solutions with H=0, this will do it:
H = @(x,y,z) x.*exp((3*x.*y./sin(x)).*z) + cos(2*x.*z./y) + exp(-0.5*x);
fimplicit3(H)
Note the complexity of the result, which suggests that no simple solution will exist. The above is merely a plot. There is no analytical form produced to generate that result.

4 件のコメント

Amy Topaz
Amy Topaz 2022 年 2 月 26 日
Thank you,
Why do we add x. (dot after x)?
per isakson
per isakson 2022 年 2 月 26 日
John D'Errico
John D'Errico 2022 年 2 月 26 日
編集済み: John D'Errico 2022 年 2 月 26 日
Consider what happens when x and y are vectors or matrices.
x = 1:5;
y = [2 3 5 7 11];
Suppose we just wanted to multiply the elements in each and find the product? See that
x.*y
ans = 1×5
2 6 15 28 55
succeeds, but x*y fails.
x*y
Error using *
Incorrect dimensions for matrix multiplication. Check that the number of columns in the first matrix matches the number of rows in the second matrix. To perform elementwise multiplication, use '.*'.
The difference is that the * operator is used in MATLAB to perform a DOT product, used in linear algebra.
As I wrote it, had I not used the dotted operators in that expression, while fimplicit3 would not have overtly failed, it would have issued warning messages.
Note that you do NOT need to use a dotted operator to multiply a scalar with a vector or matrix. MATLAB understands how to multiply 2*x.
Amy Topaz
Amy Topaz 2022 年 2 月 28 日
Thank you so much for your replies

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeCreating and Concatenating Matrices についてさらに検索

質問済み:

2022 年 2 月 26 日

コメント済み:

2022 年 2 月 28 日

Community Treasure Hunt

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

Start Hunting!

Translated by