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)?
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 Exchange에서 Matrix Indexing에 대해 자세히 알아보기

질문:

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