writing out a quadratic

16 views (last 30 days)
Asuna Rayleigh
Asuna Rayleigh on 8 Feb 2021
Edited: James Tursa on 8 Feb 2021
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.

Answers (1)

James Tursa
James Tursa on 8 Feb 2021
Edited: James Tursa on 8 Feb 2021
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);

Categories

Find more on Mathematics in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!