필터 지우기
필터 지우기

How to convert this equation to code?

조회 수: 2 (최근 30일)
Bruh
Bruh 2022년 7월 9일
댓글: Bruh 2022년 7월 9일
I think it is x*sqrt((16-x**2)**3)) but it didnt wort

답변 (3개)

Alan Stevens
Alan Stevens 2022년 7월 9일
Use ^ not **

Chandrika
Chandrika 2022년 7월 9일
As per my understanding, you want the MATLAB code for the given expression. Please try using the following code for the same:
y=x*sqrt(cube((16-sqr(x))))
function square=sqr(x)
square=x*x;
end
function cuben=cube(x)
cuben=x*x*x;
end
You can check the above script by computing 'y' for different values of x.
Hope this helps!

Sam Chak
Sam Chak 2022년 7월 9일
Hi Bruh, First, it's because you used the Python code. Second, bracket issue. Try this instead:
x.*sqrt((16 - x.^2).^3)
  댓글 수: 1
Bruh
Bruh 2022년 7월 9일
How about convert the formula to phyton code?

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

카테고리

Help CenterFile Exchange에서 Call Python from MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by