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 - The Fusion of Science and Community**

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

# MATLAB Matrix dimensional error in numerical integration

Loading...

Similar Threads - MATLAB Matrix dimensional | Date |
---|---|

How do I extract elements of a random matrix masked by a circle with its center at A(15,26) | Sep 15, 2016 |

Matlab Append new columns into Excel | Jun 20, 2016 |

Matlab error matrix function | Apr 25, 2016 |

Want gray scale image of a matrix in matlab | Aug 14, 2015 |

Matlab and preparing matrix lines | Jan 30, 2015 |

**Physics Forums - The Fusion of Science and Community**