miten tehdä vektori in matlab

To create a vector in MATLAB, you can use the following syntax:

main.m
% Row vector
vec = [1, 2, 3, 4, 5];

% Column vector
vec_col = [1; 2; 3; 4; 5];
80 chars
6 lines

You can also create vectors with a specified range or spacing:

main.m
% Vector with values from 1 to 10
vec = 1:10;

% Vector with values from 1 to 10 with a spacing of 0.5
vec_spaced = 1:0.5:10;

% Vector with 5 zeros
vec_zeros = zeros(1, 5);

% Vector with 5 ones
vec_ones = ones(1, 5);
219 chars
12 lines

These are just a few examples of how you can create vectors in MATLAB.

related categories

gistlibby LogSnag