Info

This question is closed. Reopen it to edit or answer.

How can i create a large colum variable with continious step?

1 view (last 30 days)
Hey guys, I'm new to MatLab so this might be a basic question.
I need to make a plot of a blasting vibration. The data i posses to plot on the Y-axis includes 500 000 values. On the X-axis I need to plot the time. It must include 500 000 values with a continious step of 0,005s.
So i'm guessing i need some kind of loop to make a variable with 1 colum that looks like t=[0 0,005 0,010 0,015 0,020....]
Anyone knows how i can create this in Maple?
Thanks in advance!

Answers (1)

Thorsten
Thorsten on 9 Nov 2016
Edited: Thorsten on 9 Nov 2016
You don't need a loop, you can use Matlab's colon operator to define a range of values first_value:step_size:last_value. You can also use linspace(first_value, last_value, Npoints).
y = rand(1, 500000); % fake some data
Npoints = numel(y);
delta = 0.005;
x_max = delta*Npoints - delta;
x = 0:delta:x_max;
or
x = linspace(0, x_max, Npoints);

Tags

No tags entered yet.

Community Treasure Hunt

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

Start Hunting!