marix calculation with fixed and changing value
Show older comments
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.
Answers (1)
Walter Roberson
on 30 Nov 2017
Edited: Walter Roberson
on 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 Comments
Prabha Kumaresan
on 30 Nov 2017
Walter Roberson
on 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
on 30 Nov 2017
Categories
Find more on Logical in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!