MATLAB: Matrix dimension Error while attempting to divide

matrixmatrix arraymatrix manipulation

Dear all,
The following is my Mat lab code:
clc
f = 0:1:100000;
c = (f.^2)*( (2.687/(10000000000000))+ ((7.858/100)/((f.^2)+1.226)) + ((1.481/10000)/((f.^2)+(1.522*(1000000)))) );
But I am getting the error
Error using /
Matrix dimensions must agree.
Error in npb (line 4)
c = (f.^2)*( (2.687/(10000000000000))+ ((7.858/100)/((f.^2)+1.226)) + ((1.481/10000)/((f.^2)+(1.522*(1000000)))) );
How can I fix this. Kindly help.

Best Answer

This works without error:
c = (f.^2) .* ( (2.687/(10000000000000)) + ((7.858/100) ./ ((f.^2)+1.226)) + ((1.481/10000) ./ ((f.^2)+(1.522*(1000000)))) );
Related Question