I have a function which is ranged from 0 microseconds to 50 microseconds. I just want to plot its exact copies from 0to50 microsecond,50 to 100microseconds,100 to 150 and so on

1 view (last 30 days)
Clc; Clear all; Ts=1/200e6; t=Ts:Ts:0.00005; Y=[ones(1,2000) zeros(1,8000)]; x=sin(1256e6*t + 2198e10*t.^2); z=x.*y; plot(t,z)
  4 Comments
Steven Lord
Steven Lord on 23 Feb 2020
Take a look at the pictures on the documentation page for the stairs function. If they look like what you want your plots to look like, use those examples as a model for your code.

Sign in to comment.

Accepted Answer

Star Strider
Star Strider on 19 Feb 2020
Try this:
Ts=1/200e6;
t=Ts:Ts:0.00005;
y=[ones(1,2000) zeros(1,8000)];
x=sin(1256e6*t + 2198e10*t.^2);
z=x.^y;
NR = 3; % Number Of Repeats Desired
z_extended = reshape(repmat(z(:), NR, 1), [], 1).'; % Duplicate & Convert To Vector
t_extended = linspace(Ts, max(t)*NR, numel(t)*NR); % Time Vector
figure
plot(t,z)
figure
plot(t_extended, z_extended)
Change ‘NR’ to get more copies. Note that ‘NR’ must always be an integer.
  6 Comments

Sign in to comment.

More Answers (0)

Products

Community Treasure Hunt

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

Start Hunting!