필터 지우기
필터 지우기

Solving a formula in Matlab

조회 수: 2 (최근 30일)
Belal Abboushi
Belal Abboushi 2015년 3월 6일
댓글: Roger Stafford 2015년 3월 6일
Hello everyone,
In the following formula : X= 2y + 10 log(1+ E/S)
I want the user to input X, y, and S. Is there anyway i can get matlab to give me the value of E without having to rewrite the formula?
Thank you so much!
  댓글 수: 2
Torsten
Torsten 2015년 3월 6일
Maybe by using MATLAB's "solve" ?
Best wishes
Torsten.
Roger Stafford
Roger Stafford 2015년 3월 6일
It seems a shame not to use such a simple inverse formula as:
E = S*(exp((X-2*y)/10)-1);
assuming your log is the natural logarithm. Otherwise:
E = S*(10^((X-2*y)/10)-1);

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

채택된 답변

Giorgos Papakonstantinou
Giorgos Papakonstantinou 2015년 3월 6일
편집: Giorgos Papakonstantinou 2015년 3월 6일
x = input('Enter the value of x: '); % request user input
y = input('Enter the value of y: ');
S = input('Enter the value of S: ');
f = @(E) 2.*y + 10*log(1+ E./S) - x; % create an anonymous function
[Eval, fval]= fsolve(f, 1); % solve your equation
or you can also:
syms E
f = 2.*y + 10*log(1+ E./S) == x;
solve(f, E)
If log refers to the base of 10 rewrite f by replacing log with log10.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Exponents and Logarithms에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by