MATLAB: Some constant to the power vector

MATLABvecors

i have a constant lets say c=-6; and a vector n=-20:.5:20; and i have to find (c)^n ? how can i do this?

Best Answer

Try this:
c=-6;
n=-20:.5:20;
Out = c.^n;
producing (as a column vector):
Out =
2.7351e-16 + 0i
0 + 6.6996e-16i
-1.6411e-15 + 0i
0 - 4.0198e-15i
9.8464e-15 + 0i
0 + 2.4119e-14i
-5.9078e-14 + 0i
. . .
1.0156e+14 + 0i
0 + 2.4877e+14i
-6.0936e+14 + 0i
0 - 1.4926e+15i
3.6562e+15 + 0i
Related Question