I need to repeat two signals combined periodically as a single curve in matlab

2 views (last 30 days)
Hi Friends
I want to get a graph of y vs t. This graph should have pattern in the form of a sine wave and straight line pattern connected periodically. Example, from t=0 to t=5 curve pattern is sine wave then from t=5 to t=10 pattern is is straight line then from t=10 to t=15 pattern is sine wave and from t=15 to t=20 pattern is a straight line and so on.
I want to plot that graph of such pattern in Matlab using m-file or using simuling block.
Someone Please help.Its urgent

Accepted Answer

sixwwwwww
sixwwwwww on 6 Dec 2013
you can do something like this:
for i = 0:4 * pi:16 * pi
t1 = linspace(i, i + 2 * pi, 100);
y1 = sin(t1);
t2 = linspace(i + 2 * pi, i + 4 * pi, 100);
y2 = zeros(1, numel(t2));
plot(t1, y1, t2, y2), hold on
end

More Answers (0)

Categories

Find more on Programming in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!