Effacer les filtres
Effacer les filtres

Please help me make this function periodic

1 vue (au cours des 30 derniers jours)
Vinh Le
Vinh Le le 17 Fév 2019
Thank you very much for all the help!
T = 1 millisecond
Vm = 1 volt (amplitude voltage)
t = linspace(-T, 2*T, 3001)
The following pararameter is given
v(t) = Vm - (Vm/T)t for 0<= t <= T
0 elsewhere
I need to modify the vector v so that is represents a periodic function with a period T over this time period
(hint: it should look like a sawtooth), and plot v vs t over the range from -T to 2T.
So far I have this:
T = 1;
Vm = 1;
t = linspace(-T,2*T,3001);
for i = 1:length(t)
if (t(i) >= 0) && (t(i) <= T)
v(i) = Vm - (Vm/T)*t(i);
else
v(i) = 0;
end
end
plot(t,v)

Réponses (2)

Agnish Dutta
Agnish Dutta le 27 Fév 2019
You can repeat copies of an array along any dimension using the 'repmat()' function. This will allow you to generate a periodic function. The following link contains the documentation for the same:
In addition, refer to the following MATLAB answer link which has a query of the same nature as the one you've asked. Go through the accepted answer.

Bjorn Gustavsson
Bjorn Gustavsson le 27 Fév 2019
Write a function for that pulse shape, then have a look at the pulstran function.
HTH

Catégories

En savoir plus sur MATLAB dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by