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

1 Ansicht (letzte 30 Tage)
Dion Akmal
Dion Akmal am 24 Mär. 2021
Bearbeitet: Dion Akmal am 24 Mär. 2021
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);

Akzeptierte Antwort

Matt J
Matt J am 24 Mär. 2021
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 Kommentare
Matt J
Matt J am 24 Mär. 2021
You're welcome, but please Accept-click the answer to indicate that it helped.
Dion Akmal
Dion Akmal am 24 Mär. 2021
Bearbeitet: Dion Akmal am 24 Mär. 2021
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)

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu MATLAB finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by