Calculating integral in MATLAB
5 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Syed Izhar Ul Haq
el 23 de Mzo. de 2021
Comentada: David Hill
el 24 de Mzo. de 2021
how can I calculate the integral as shown in the screen shot. where j1 is of 1x3 matrix and j2 is also 1x3 matrix. while g1 is 300x3 matrix and also g2 is 300x3 matrix.
in the screen shot the '.' represents the dot product. your suggestion and help would be highly appreciated

0 comentarios
Respuesta aceptada
David Hill
el 23 de Mzo. de 2021
Editada: David Hill
el 23 de Mzo. de 2021
I am assuming each row of g1 and g2 is going from T=0 to t; otherwise you will have to describe the functions g1 and g2 and how they relate to T (since the integration is with respect to it). I assume you can treat the integration as a summation.
dT=t/300;%not sure what t is and I assume the change is consistent point to point
AlphaGyr=dT*(dot(g1,repmat(j1,300,1))-dot(g2,repat(j2,300,1)));%dot is just sum(g1.*repmat(j1,300,1))
2 comentarios
Syed Izhar Ul Haq
el 24 de Mzo. de 2021
Editada: Syed Izhar Ul Haq
el 24 de Mzo. de 2021
David Hill
el 24 de Mzo. de 2021
The dot product of a matrix does the sumation automatically so you don't need a loop. You just need to create same size matrix out of j1 and j2 as g2 and g2 using repmat. Below should work. Yes the final answer will be 1x300.
dT=100;
AlphaGyr=dT*(dot(g1,repmat(j1,300,1))-dot(g2,repat(j2,300,1)));
Más respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!