marix calculation with fixed and changing value
Ältere Kommentare anzeigen
A=[1 2 ;
3 4;
5 6;],
B=[ 1 2 3;
4 5 6;
7 8 9;]
C=[1 2 3 4;
5 6 7 8;
9 10 11 12;]
D=[1 2 3 4 5;
6 7 8 9 10;
11 12 13 14 15;]
in matrix A,B,C,D the number of rows remain the same whereas the number of columns also get varied.
How to form the code for this condition and also how the graph can be plotted with fixed rows on the x axis and variable colums on the y axis.
Antworten (1)
Walter Roberson
am 30 Nov. 2017
Bearbeitet: Walter Roberson
am 30 Nov. 2017
You do not indicate how the number of columns should vary, so we will arbitrarily choose the number randomly, and choose the contents randomly
numrows = 3;
%choose number of columns
numcols = randi(flintmax-1, 1, 1);
%now fill them with something
E = randi(15, numrows, numcols);
%now plot with the fixed rows on the x axis and the variable columns on the y axis
plot(E.')
3 Kommentare
Prabha Kumaresan
am 30 Nov. 2017
Walter Roberson
am 30 Nov. 2017
No, sorry, your question does not permit this problem to be removed.
In order to remove this problem, you would have to have a maximum limit on the number of columns, and that limit could not exceed 4.4 million per gigabyte of memory you have (assuming 3 rows.)
Your question requires any number of columns. I was already ruining the problem when I imposed an upper limit of 2^53 - 1 columns.
Prabha Kumaresan
am 30 Nov. 2017
Kategorien
Mehr zu Logical finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!