How do I create a vector which elements are the output of another vector run through an equation?
Show older comments
Okay so I have an equation (a polynomial) and a starting vector. What I need is for each element of the vector to be input into the polynomial and the output of that be made into a new vector. I hope that makes sense.... essentially what I have is y=x^2 p=[1;2;3;4] and what I need to happen is have some way to make a vector r such that r=[1;4;9;16]. Does anybody know how to do this?? Thanks!
Answers (1)
x = 1:4 ;
y=x.^2
1 Comment
Torsten
on 22 Sep 2022
But as you see above, it gives back a vector. So something must be wrong on your side.
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!