필터 지우기
필터 지우기

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 CenterFile Exchange에서 MATLAB에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by