MATLAB Answers

How can I turn the following matrix into an image?

2 views (last 30 days)
erfan nori
erfan nori on 22 Jan 2021
Commented: erfan nori on 25 Jan 2021
Hi, I have generated a matrix using the chaos function as follows. Now I want to convert this matrix to a color image with dimensions of 16 x 16 pixels.
r=3.67;
n=6144;
x=zeros(1,n);
x(1)=0.35578;
for i=2:n
x(i)=r*x(i-1)*(1-x(i-1));
end
Help me please

Answers (1)

Constantino Carlos Reyes-Aldasoro
Well, an image of 16 rows, 16 columns would have 256 pixels. That would be the first consideration, after running your code you have the following:
>> whos
Name Size Bytes Class Attributes
i 1x1 8 double
n 1x1 8 double
r 1x1 8 double
x 1x6144 49152 double
So, x has 6,144 elements. How would you go from there to 16x16? You may discard, average or many other techniques, but I guess that you need to sort out first the dimensions.
  3 Comments
erfan nori
erfan nori on 25 Jan 2021
I will find a very good solution myself, thank you for your efforts

Sign in to comment.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by