Filter löschen
Filter löschen

error using solve function

1 Ansicht (letzte 30 Tage)
studentU
studentU am 13 Mai 2015
Kommentiert: Torsten am 22 Mai 2015
hi,
I use the function solve to determine a variable as follows:
x = solve (cos (x) * sin (y) * cos (z) + sin (Z) = 1 ',' x ')
then I evaluated x in terms of y and z, when I replace x by the value finding the equation is not = 1!!
how can i resolve it?

Antworten (1)

Walter Roberson
Walter Roberson am 13 Mai 2015
Are x and y and z symbolic at the time you call solve? Or are y and z numeric?
If they are symbolic and you later substitute in numeric y and z to the solve() response get a numeric x, and then substitute the numeric x, y, and z into the cos (x) * sin (y) * cos (z) + sin (Z) formula, then you could get something other than 1 due to round-off error.
Also, if your y and z are square matrices of numeric values, then cos (x) * sin (y) * cos (z) would succeed but what not be what you want: you would need to evaluate
cos(x) .* sin(y) .* cos(z)
Notice the ".*" instead of "*" if you are working with vectors or matrices.
  4 Kommentare
studentU
studentU am 13 Mai 2015
Bearbeitet: studentU am 13 Mai 2015
I used simplify () but the result is always diferrent 1,
However, how to limit the interval of solution; for
x = solve ('cos (x) * sin (y) * cos (z) + sin (Z) = 1 ',' x ')
i want x beteween 0° and 90° for exmple,
thank's lot,
Torsten
Torsten am 22 Mai 2015
I'd be interested what you get for x after applying "solve".
Best wishes
Torsten.

Melden Sie sich an, um zu kommentieren.

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by