How to calculate the integration with Matlab?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Trung Khoa Le
am 26 Mär. 2018
Kommentiert: Rena Berman
am 5 Apr. 2018
I need support in calculating integration of function below. I tried to use int(), integral() in matlab documentation, but it did not work. You can help me either by providing key works so that I google it, or providing me matlab code as an example for later use. Thanks
2 Kommentare
Jan
am 26 Mär. 2018
This looks like a homework question: "10pt". Then please post, what you have tried so far and ask a specific question. See how-do-i-get-help-on-homework-questions. Thanks.
Akzeptierte Antwort
Birdman
am 26 Mär. 2018
Try this:
syms U(t) X(t) s
R=0.01;C=4;
U(t)=piecewise(t<0,0,t>=0,sin(100*pi*t));
fun(s)=exp(-s/(R*C))*U(t-s);
X(t)=(1/R*C)*int(fun,s,0,Inf);
t=0:0.001:0.2;
Xt=X(t); %X(t) function is calculated for t vector
plot(t,Xt)
5 Kommentare
Birdman
am 26 Mär. 2018
He said he used int(), integral() and was unable to solve the question. I believe that he showed effort.
Weitere Antworten (1)
Walter Roberson
am 26 Mär. 2018
When you have a fixed number of samples then evaluate the function at the provided locations and use trapz()
Siehe auch
Kategorien
Mehr zu Numerical Integration and Differentiation finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!