Info
Diese Frage ist geschlossen. Öffnen Sie sie erneut, um sie zu bearbeiten oder zu beantworten.
error in creating a vector the spans the length of another vector
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
i am trying to make vector that ranges from 0 to 7/a for each value of a and contains 20 evenly spaced values.
a is a 1x5 vector
ive tried using linspace (Var=linspace(0,7/a,20))and the colon operator (Var=1:20:7/a) but using each, i get the following error message:
Error using /
Matrix dimensions must agree.
should i use a for loop?
0 Kommentare
Antworten (1)
Ameer Hamza
am 24 Sep. 2020
Each row of M corresponds to one value in a
a = [1 2 3 4 5];
M = arrayfun(@(x) linspace(0, 7/x, 20), a, 'uni', 0);
M = vertcat(M{:});
0 Kommentare
Diese Frage ist geschlossen.
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!