MATLAB: Use a vector a range of input values for a function

functionvector

I have a function: angle_of_twist = (32 * T * L) / (G * ((D)^4) * 3.14) and I need to do this:
T=1
L=1
G=26000000000
5)Now perform the same calculation for a range of diameters specified by vector D = [0.001:0.0001:0.02] and save the result in variable Phi.

Best Answer

I think the following is what you want to do. Just FYI, I would recommend replacing '3.14' by pi for more precise calculation.
T = 1;
L = 1;
G = 26000000000;
D = 0.001:0.0001:0.02;
Phi = (32 * T * L) ./ (G * (D.^4) * 3.14);