필터 지우기
필터 지우기

How to solve a cosine function raised to the 3rd power

조회 수: 20 (최근 30일)
Shane Palmer
Shane Palmer 2020년 5월 4일
편집: Maximilian Schönau 2020년 5월 4일
Hello,
I am trying to use the matlab solver to determine the roots for this trig function:
eqn = solve(1.5936==(2-3*cos(theta)+cos(theta)^3),theta)
Any ideas? I am not seeing how to do this easily.

답변 (1개)

Maximilian Schönau
Maximilian Schönau 2020년 5월 4일
Hi, you probably forgot to define theta as a symbolic variable. Use "sym" to do that.
syms theta
eqn = solve(1.5936==(2-3*cos(theta)+cos(theta)^3),theta)
  댓글 수: 2
Shane Palmer
Shane Palmer 2020년 5월 4일
Hello,
Sorry, I didn't point that out, I did include the syms command, and it gives me a couple of roots, with z variables. Unsure...
sym theta
eqn = solve(-0.6044==-3*cos(theta)+cos(theta)^3,theta)
Maximilian Schönau
Maximilian Schönau 2020년 5월 4일
편집: Maximilian Schönau 2020년 5월 4일
Ok, then use "vpa" to convert from symbolic to numeric result. Matlab trys to stay with symbolic variables as long as it can, wich sometimes is usefull and sometimes is not
syms theta
eqn_symbolic = solve(-0.6044==-3*cos(theta)+cos(theta)^3,theta)
eqn_numeric = vpa(eqn_symbolic)

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

카테고리

Help CenterFile Exchange에서 Calculus에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by