I want to create a function that I can plot

y1 = -10^(0.5.*x) + sin(x) * abs(x.^3 - 4.*x - 1);
Incorrect dimensions for raising a matrix to a power. Check that the matrix is square and the
power is a scalar. To perform elementwise matrix powers, use '.^'.
^ This is the error I am getting and I'm trying to fix it but I'm stuck.

답변 (1개)

the cyclist
the cyclist 2021년 8월 11일
편집: the cyclist 2021년 8월 11일
You needed elementwise operations in several places that you did not use it:
x = 1:5;
y1 = -10.^(0.5.*x) + sin(x) .* abs(x.^3 - 4.*x - 1);
plot(x,y1)

카테고리

도움말 센터File Exchange에서 Mathematics에 대해 자세히 알아보기

제품

릴리스

R2021a

태그

질문:

2021년 8월 11일

편집:

2021년 8월 11일

Community Treasure Hunt

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

Start Hunting!

Translated by