フィルターのクリア

Please help me make this function periodic

1 回表示 (過去 30 日間)
Vinh Le
Vinh Le 2019 年 2 月 17 日
回答済み: Bjorn Gustavsson 2019 年 2 月 27 日
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)

回答 (2 件)

Agnish Dutta
Agnish Dutta 2019 年 2 月 27 日
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 2019 年 2 月 27 日
Write a function for that pulse shape, then have a look at the pulstran function.
HTH

カテゴリ

Help Center および File ExchangeMATLAB についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by