Filter löschen
Filter löschen

ploting in matlab R2017b

3 Ansichten (letzte 30 Tage)
Antonis Koutsis
Antonis Koutsis am 1 Dez. 2020
Bearbeitet: Antonis Koutsis am 1 Dez. 2020
hi guys,
i want to plot this on matlab:
, ω=frequency
here is my code: (there is a problem that i cant find). THANKS for any help :)
f=-20:0.1:20;
w = 2*pi*f;
syms m
a= (((4*pi)/3j)*(sin(w)));
x1 = int(dirac(2*pi*f) -((2*pi*m)/3),m,-Inf,Inf);
x= a.*x1;
stem(x,f)

Antworten (1)

Walter Roberson
Walter Roberson am 1 Dez. 2020
That outcome is correct given that integral -- if you expected a different output then what you integrate is not correct.
int(dirac(2*pi*f) -((2*pi*m)/3),m,-Inf,Inf)
dirac(2*pi*f) is constant compared to m, so integrating it with respect to m from A to B is going to give you
dirac(2*pi*f)*B - dirac(2*pi*f)*A
dirac(2*pi*f)*(B-A)
but B is inf and A is -inf so that would be dirac(2*pi*f) * (inf-(-inf)) => dirac(2*pi*f) * inf .
dirac(2*pi*f) is 0 whenever f is non-zero. 0 * inf is nan. Therefore the int(dirac*2*pi*f), m,-inf,inf) is going to give nan in all positions except where f == 0.
dirac(2*pi*0) = dirac(0) . dirac is a "distribution", not a function as is typically understood, but the distribution has value infinity except when dirac(expression) is being integrated with respect to a variable involved in the expression. For example int(dirac(2*pi*m), m, -inf, inf) potentially has non-infinite meaning, but dirac(0), m, -inf, inf) is always going to be infinity. So at f == 0, the integral of the dirac(0) is infinity * (infinity - (-infinity)) -> infinity .
Thus, taking into account just the first term, it is NaN in each case where f is non-zero, and infinity in the case where f is 0.
The second term, which is of the form constant*m, integrates to (1/2*constant*m^2) evaluated at infininity minus the evaluation at -infinity. 1/2*constant * infinity^2 is infinity times sign(constant) for non-zero constant (i.e., -2*pi/3) and 1/2*constant*(-infinity)^2 is infinity times sign(constant) . infinity*sign(constant) - infinity*sign(constant) ... is undefined, because it is the subtraction of two infinities.
So the integral of the second term is undefined (nan) for all f values . The first term is nan for all f except 0, and the second term is nan for all f including f == 0.
Therefore, the integral is nan for all f values.
Therefore there is nothing to plot.
... Even if you repair your syntax to stem(f, x) -- since your x is actually your dependent variable and your f is your independent variable.
  1 Kommentar
Antonis Koutsis
Antonis Koutsis am 1 Dez. 2020
Bearbeitet: Antonis Koutsis am 1 Dez. 2020
oh, yes you're right!! thank you for the explanation
so i have to make this frequency spectrum by hand...(something i dont want...mehhhh)
anyway thank you very much!! :)

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Creating and Concatenating Matrices 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