writing out a quadratic

조회 수: 1 (최근 30일)
Asuna Rayleigh
Asuna Rayleigh 2021년 2월 8일
편집: James Tursa 2021년 2월 8일
My x value is -2:0.001:1.7 and my y value is supposed to be y=32-4x^2.3+7sqrt(x). Whenever I try to write out the y-value I keep on getting a syntax error and i am not sure how to fix.
Please help.

답변 (1개)

James Tursa
James Tursa 2021년 2월 8일
편집: James Tursa 2021년 2월 8일
Use the element-wise operators that include the "dot" (such as .^ instead of just ^), and use the multiply operator * between the constants and the variables:
x = -2:0.001:1.7;
y = 32 - 4*x.^2.3 + 7*sqrt(x);

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by