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 Ansicht (letzte 30 Tage)
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 Kommentare
Steven Lord
Steven Lord am 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.

Melden Sie sich an, um zu kommentieren.

Akzeptierte Antwort

Star Strider
Star Strider am 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 Kommentare

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Produkte

Community Treasure Hunt

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

Start Hunting!

Translated by