Calculating integral in MATLAB
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Syed Izhar Ul Haq
am 23 Mär. 2021
Kommentiert: David Hill
am 24 Mär. 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 Kommentare
Akzeptierte Antwort
David Hill
am 23 Mär. 2021
Bearbeitet: David Hill
am 23 Mär. 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 Kommentare
Syed Izhar Ul Haq
am 24 Mär. 2021
Bearbeitet: Syed Izhar Ul Haq
am 24 Mär. 2021
David Hill
am 24 Mär. 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)));
Weitere Antworten (0)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!