How to convert this equation to code?
1 次查看(过去 30 天)
显示 更早的评论
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/1059845/image.png)
I think it is x*sqrt((16-x**2)**3)) but it didnt wort
0 个评论
回答(3 个)
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!
0 个评论
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)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Call Python from MATLAB 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!