Hi,(adsbygoogle = window.adsbygoogle || []).push({});

I tried to numerically integrate an equation in matlab using the trapezium method. Here is the code that I wrote:

ao = 1;

X = 0:ao/10:ao;

Y = 1/sqrt((power(Ho,2)*((O_m*power(X,-1))+(O_r*power(X,-2))+(O_l*power(X,2))))-(k*power(c,2)));

age = trapz(X,Y);

where the values for O_m, O_r, O_l and k were obtained using input(). When I executed the above code, I get "Error using / Matrix dimensions must agree."

Can you tell me what the problem is?

Sarrvesh

**Physics Forums | Science Articles, Homework Help, Discussion**

Dismiss Notice

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# MATLAB Matrix dimensional error in numerical integration

**Physics Forums | Science Articles, Homework Help, Discussion**