how to integral f(x).*g(x)

조회 수: 1 (최근 30일)
Dion Akmal
Dion Akmal 2021년 3월 24일
편집: Dion Akmal 2021년 3월 24일
can somebody help me with my problem. here is my code and it cant be run
f = 0.05:0.05:0.4
t=0:.01:20
X=cos(2*pi*f*t)
Y=cos(2*pi*f*t)
g = @(t) X.*Y;
I = integral(g,0,20,'ArrayValued',true);

채택된 답변

Matt J
Matt J 2021년 3월 24일
f = 0.05:0.05:0.4;
% t=0:.01:20;
X=@(t) cos(2*pi*f*t);
Y=@(t) cos(2*pi*f*t);
g=@(t) X(t).*Y(t);
I = integral(g,0,20,'ArrayValued',true)
I = 1×8
10.0000 10.0000 10.0000 10.0000 10.0000 10.0000 10.0000 10.0000
  댓글 수: 3
Matt J
Matt J 2021년 3월 24일
You're welcome, but please Accept-click the answer to indicate that it helped.
Dion Akmal
Dion Akmal 2021년 3월 24일
편집: Dion Akmal 2021년 3월 24일
can you help me again sir ?, why my code below is error, f in my code is scalar that is 0.05, 0,1 , 0.15, 0.2, ...,0.4
f= 0.05 : 0.05 : 0.4
t = 0 : 0.001 : 20
Y = cos(2*pi*0.1*t)

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by