Question 2:
CODE :
a = uint8(zeros(100,100)); %UINT8 Convert to unsigned 8-bit
integer.
int = floor(linspace(255,0,100)); % generate 100 level form 255
(white) to 0 (black)
for i=1:100
for j=1:100
a(i,j)=int(i); % i choose the row number
end
end
imshow(a) % display image
imwrite(a,'test2.png'); % to write image
Result:
Image:
Question 3:
CODE :
a = uint8(zeros(100,100)); %UINT8 Convert to unsigned 8-bit
integer.
int = floor(linspace(0,255,100)); % generate 100 level form 0
(black) to 255 (white)
for i=1:100
for j=1:100
a(i,j)=int(j); % i choose the row number
end
end
imshow(a) % display image
imwrite(a,'test3.png'); % to write image
Result:
Image:
Question 4:
CODE :
a = uint8(zeros(100,100)); %UINT8 Convert to unsigned 8-bit
integer.
int = floor(linspace(255,0,100)); % generate 100 level form 255
(white) to 0 (black)
for i=1:100
for j=1:100
a(i,j)=int(j); % i choose the row number
end
end
imshow(a) % display image
imwrite(a,'test4.png'); % to write image
Result:
Image:
Question 2 Problem Definition Write a MATLAB script that uses nested loops to create a 100 by 100...
answer 8 using matlab Using nested loops, traverse through the matrix for the following. a) Replace all elements divisible by 3 with 100. b) Replace all elements divisible by 2 with 50. c) Replace the first element of each row with 10. d) Display the all elements of the 2D matrix as a 10 array (9 elements in 1 row) 8) Write a function file that determines the maximum element of an input matrix A using nested loops and counts...
USING MATLAB: Please show how to do this in Matlab a) Create a script file that uses three sets of nested loops to calculate the final temperature of a light bulb filament. The three nested loops are necessary to calculate Tf for all possible combinations of P, A, and Ti for the engineering formula below. The output from the script should be a 1xn vector representing the values of Tf. You must initialize the output variable so it does not...
Matlab Question 2. For this problem you have to create a program that defines two vectors of numbers: A and B and uses a for-loop to combine the values of A and B. Note that different parts of the question below specify different orders for combining the elements. To start this exercise start a MATLAB script called q2.m and put, at the top, the vector definition: B [11:20] Question 2a: Problem definition Copy the file q2.m to q2a.m. For this...
Problem 2. Write a MATLAB script that uses nested loop statements to print the following multiplication table. 4 8 12 16 5 10 15 20 25
Problem Definition Write a program called process_ages that reads in an array of up to 10 integers representing peoples ages in years and calculates and prints the maximum age and the minimum age and the average age. Your program should stop reading when either the 10th number is entered or the user enters -1. If the user enters any other negative number or a value above 150, they should be warned and prompted again for a valid age. You should...
Task 3: Image Scaling 3D Array Indexing Write a MATLAB script which reads an image file with imread ), uses matrix indexing to scale the mage down by a factor of 1/10th, then displays the result with image () . You may use any image of your choosing. able on Blackboard. i doubt, the mage used in lectures is avail Task 3: Image Scaling 3D Array Indexing Write a MATLAB script which reads an image file with imread ), uses...
Please I need help with MATLAB .. PLease help me . Thankyou Write Matlab code to plot a 2D sinc function over a 2D cartesian grid where x ranges from 100 to 355 and y ranges from 0 to 255 and the sinc is centered at somewhere not midway in the grid. First plot the grid, and then plot the function on the grid (both as grayscale and as a surface plot). Comment the code well, generate the figures and...
In this assignment, you will write a program in C++ which uses files and nested loops to create a file from the quiz grades entered by the user, then reads the grades from the file and calculates each student’s average grade and the average quiz grade for the class. Each student takes 6 quizzes (unknown number of students). Use a nested loop to write each student’s quiz grades to a file. Then read the data from the file in order...
the picture above is the one you are supposed to use for the MATlab code please help Problems. Grayscale images are composed of a 2D matrix of light intensities from O (Black) to 255 (White). In this lab you will be using grayscale images and do 2D-array operations along with loops and iflelse branches. 1. We can regard 2D grayscale images as 2D arrays. Now load the provided image of scientists at the Solvay Conference in 1927 using the imread)...