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

1 vue (au cours des 30 derniers jours)
Dion Akmal
Dion Akmal le 24 Mar 2021
Modifié(e) : Dion Akmal le 24 Mar 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);

Réponse acceptée

Matt J
Matt J le 24 Mar 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 commentaires
Matt J
Matt J le 24 Mar 2021
You're welcome, but please Accept-click the answer to indicate that it helped.
Dion Akmal
Dion Akmal le 24 Mar 2021
Modifié(e) : Dion Akmal le 24 Mar 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)

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur MATLAB dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by