hi, im fairly inexperienced in matlab so any help would be useful here basically i ave simple bit of code and i need to solve an equation for x where in the equation another preassigned variable is used
solve ('cos(x/b) + sin(x/b) - 0.7==x')
here 'b' should be a constant that's already been assigned earlier
also i'm having trouble getting answers from 'solve' to be stored in a variable. any help would be greatly appreciated.

 채택된 답변

David Sanchez
David Sanchez 2013년 12월 13일

0 개 추천

The following code should not give you any trouble:
syms x
b = 3; % use your own value here
my_answer = solve (cos(x/b) + sin(x/b) - 0.7==x);
It yields:
my_answer =
0.43360539229972390998442935562107

댓글 수: 2

Walter Roberson
Walter Roberson 2013년 12월 13일
Note: this syntax will not work until about R2011b (I think it was). For earlier versions, change the "==x" to "-x"
robert perry
robert perry 2013년 12월 13일
i'm using R2013a so that's brilliant thanks, it was the ' syms x ' i was missingto make it work

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Programming에 대해 자세히 알아보기

질문:

2013년 12월 13일

댓글:

2013년 12월 13일

Community Treasure Hunt

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

Start Hunting!

Translated by