Finding Y vector using a given X vector and a equation

7 Ansichten (letzte 30 Tage)
Chandler Vaughan
Chandler Vaughan am 3 Okt. 2019
Beantwortet: Jess Lovering am 3 Okt. 2019
I have the equation Y= X^2
Given X = [1:0.5:3]
Calucluate in code the Y Vector
How Do I So .
  2 Kommentare
Matt J
Matt J am 3 Okt. 2019
In what way are you "overthinking" it? What are you thinking?
Chandler Vaughan
Chandler Vaughan am 3 Okt. 2019
So I had simply put the vector X in the equation and solved for Y, (I have to handwrite the code) but I feel as since I solved for Y using a vector, and got a vector answer, I dont think that is the correct way to do it?

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Jess Lovering
Jess Lovering am 3 Okt. 2019
You have to define your vector and then pass it into your equaiton but make sure to use .^ instead of ^ so that it goes element-wise through your equation.
X = [1:0.5:3]
Y = X.^2

Kategorien

Mehr zu Mathematics finden Sie in Help Center und File Exchange

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by