I want to solve a sinus equation.

Hi,
I want to solve this equation for X in a function with b, c and d as parameters :
b*sin(c)=d*sin(x)
Maybe i'm seeing this wrong, but I tried to solve for X using solve() but it gives me
>> s = solve(b*sin(y)=c*sin(x),x)
??? s = solve(b*sin(y)=c*sin(x),x)
|
Error: The expression to the left of the equals sign is not a valid target for an assignment.
Edit : I want a x between 0 and 2pi.
Thanks a lot,
Seb

Answers (3)

Matt Fig
Matt Fig on 2 Oct 2012
Edited: Matt Fig on 2 Oct 2012
x = asin(b*sin(c)/d)
Or, if you want MATLAB to do it:
solve('b*sin(c)-d*sin(x)','x')
You want x to be on [0 pi]? You have three unknowns to work with, so that means you will have an infinite number of solutions.
How about b = 0, d equal to any nonzero number, and c equal to any number you want?
Walter Roberson
Walter Roberson on 2 Oct 2012
The ability to use "=" inside solve() was new in R2012a. You will need to use a technique such as shown in Matt's answer if you are using an older version.
You're just forgetting the apostrophes
solve('b*sin(c)=d*sin(x)')
ans =
asin((b*sin(c))/d)
pi - asin((b*sin(c))/d)

1 Comment

Or, if you want to use symbolic variables, use "==" instead of '='
s = solve(b*sin(y)==c*sin(x),x)
s =
asin((b*sin(y))/c)
pi - asin((b*sin(y))/c)

Sign in to comment.

Categories

Asked:

seb
on 2 Oct 2012

Community Treasure Hunt

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

Start Hunting!