Matlab for Beginners, Plotting from a matrix!
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Hello, this is building from last post, I am dumb in matlab, and greatly appreciate your help. It should not be hard if I was smart enough.

23431 20757 21860 47209
23760 21059 22144 47781
25986 22832 23719 50101
This is a matrix, in the first picture, and the numbers above are the first three lines. Please provide code to divide the first three numbers, by the fourth number on each line respectively. Then, you will get three values for each line, simply then plot the three values to X, Y, X dimensions respectively. Result should be graph.
Thank you so much!
I admit I am new and very dumb in matlab.
0 comentarios
Respuestas (1)
David Hill
el 4 de Feb. de 2020
I assumed you wanted 3d graph (X,Y,Z).
M=%your maxtrix
m=M(:,1:3).*repmat(M(:,4),1,3);
plot3(m(:,1),m(:,2),m(:,3))
3 comentarios
David Hill
el 6 de Feb. de 2020
M(:,1:3) is all rows and columns 1 through 3 of matrix M.
The repmat() function repeats matrixes or vectors to create a new matrix. You should look at the function yourself in the document section of Matlab. repmat(M(:,4),1,3) makes a matrix of column 4 of M repeated 3 times.
Ver también
Categorías
Más información sobre Graph and Network Algorithms en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!