Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

SOLVE PROBLEM 3 USING MATLAB 14444;444 4; 4444], etc. Display the data on For ex

ID: 3736125 • Letter: S

Question

SOLVE PROBLEM 3 USING MATLAB

14444;444 4; 4444], etc. Display the data on For example: 122 2, 221, the screen. Can this be accomplished with an array of structures where each structure has two elements; the value and the string equivalent as in the cell array? (YN) 3. Create a 200x200 matrix of integers- and initialize it to zero. Set the value of each element to be 128exp(-d/20) where d is the radial distance from the center of the image/matrix (100,100). Display the image with a 256-element gray colormap using the command, image() and also imagesc( ).Note and explain the differences in the comment section (Make it short).

Explanation / Answer

Solution:

code:

clear;
clc;

a=zeros(200,200); %zeros matrix of size 200X200
%for every entry in a
for i=1:200
    for j=1:200
        d=sqrt((100-i).^2 + (100-j).^2); %calculate radial distance of each entry from center of array
        a(i,j)=128.*exp(-d/20); %calculate the color value and assign to array
    end
end
image(a);   %display array as image not using full range of colors in color map
figure,imagesc(a); %display array as image using full range of colors in color map

I hope this helps if you find any problem. Please comment below. Don't forget to give a thumbs up if you liked it. :)