How to calculate the integration with Matlab?

조회 수: 1 (최근 30일)
Trung Khoa Le
Trung Khoa Le 2018년 3월 26일
댓글: Rena Berman 2018년 4월 5일
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
Jan
Jan 2018년 3월 26일
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.
Rena Berman
Rena Berman 2018년 4월 5일
(Answers Dev) Restored edit

댓글을 달려면 로그인하십시오.

채택된 답변

Birdman
Birdman 2018년 3월 26일
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
Birdman
Birdman 2018년 3월 26일
He said he used int(), integral() and was unable to solve the question. I believe that he showed effort.
Trung Khoa Le
Trung Khoa Le 2018년 3월 26일
Yes I did, first I tried syms t,s but it did not work, then I tried work-around solutions (searching on the Internet) to find out reasons, but could not find anything. It is homework but not mine. I just tried to do it as the way to learn Matlab ^^.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Walter Roberson
Walter Roberson 2018년 3월 26일
When you have a fixed number of samples then evaluate the function at the provided locations and use trapz()
  댓글 수: 1
Trung Khoa Le
Trung Khoa Le 2018년 3월 26일
Thanks, will try on your way in the future.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Numerical Integration and Differentiation에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by