Invalid expression, please help me

조회 수: 2 (최근 30일)
John Mallia
John Mallia 2021년 3월 17일
댓글: Walter Roberson 2021년 3월 17일
whenever I try to enter this code I keep getting an Invalid expression.
x=log|3+cos^2*1.45|+6exp^-0.2+log10(5)/sqrt2+5^-0.8

채택된 답변

Walter Roberson
Walter Roberson 2021년 3월 17일
x = log(abs(3+cos(1.45)^2)) + 6 * exp(-0.2) + log10(5) / sqrt(2) + 5^(-0.8)
maybe. the abs() is questionable. The * after the cos^2 is quite questionable. And I am morally certain that some brackets are missing in the original equation.
  댓글 수: 3
Brieuc DANIEL
Brieuc DANIEL 2021년 3월 17일
I think it may looks like something like that
x = (log(3 + cos(1.45)^2) + 6 * exp(-0.2) + log10(5)) / (sqrt(2+5^-0.8))
Walter Roberson
Walter Roberson 2021년 3월 17일
I see that my moral certainty was correct, that brackets were missing.
For future reference, please note that in mathematics, the operation |x| very frequently means that some kind of magnitude is to be calculated. For example, it is often used to indicate absolute value, but it can also in some contexts mean things like the number of elements in a set, or the length of a string. This is completely different than using [x] which often are just providing brackets for grouping purposes, especially in the tall form like in the diagram; but [] after a word can also indicate a function call, and [] is also used in some contexts to indicate indexing. So... if you see tall [] in an expression and you are transcribing that, transcribe as [] not as solid vertical bars.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Type Conversion에 대해 자세히 알아보기

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by