question archive Write a MATLAB script which plots the following function: y = (1 -e k ) cos(2n ft) (1) for: k = 0
Subject:MathPrice: Bought3
Write a MATLAB script which plots the following function: y = (1 -e k ) cos(2n ft) (1) for: k = 0.7 f = 3.5 t = [0, 5] The [0, 5] syntax means "from 0 to 5, including both 0 and 5". Your script should plot 1000 data points with the default line style and colours provided by the plot ( ) function. For full marks you also need to: . Write vectorised code. You are not permitted to use any loops or conditional statements. Pay careful attention to MATLAB element-wise operator behaviour. -1 if for loops etc are used. . Comment your code with a description of what the script does. -0.5 marks if missing . The values of t must include both 0 and 5. -1 mark if t stops close to, but not exactly on, 5. . t must contain exactly 1000 data points. -1 mark if t does not contain 1000 points. . Allow the script to be easily modified with new values for k, f, and t. -1 mark if these are not clearly initialised and easy to modify (eg: if they are hard coded into the equation instead of being variables). . Annotate the plot with axis labels and a title. -1 mark if missing. Read the MATLAB help documentation on xlabel (), ylabel (), and title () to learn how to do this. The labels are to be: - X-label: "Time (s)" -y-label: "Voltage (V)" Title: "Transient"
You have been provided with seven images named IMG_5698 . JPG to IMG_5704. JPG. These images were taken in low light conditions with a very high ISO setting which results in "noise" on the image (random fluctuations in pixel intensity) and "bright pixels" (pixels which appear bright in every image, despite not being hit by light). In addition to the seven source images you are also provided with a "dark frame", dark . png. This is a photograph taken with the lens cap installed and measures the "bright pixels" intensity. Write a MATLAB script which performs the following tasks: 1. Calculates the mean of all seven images 2. Subtracts the dark frame from the "mean" image 3. Performs a threshold to blacken "nearly black but not quite" pixels. The threshold value, assuming a 0-255 intensity range, is to be 25. ie: any intensity value on any pixel channel less than 25 should be set to zero. 4. Displays the result. Marking notes: . Comments are not required for this task . The images are all loaded correctly: 1 mark . The mean calculation is performed correctly: 2 marks . You will be awarded one of the following for vectorisation: - Fully vectorised code: 2 marks - Unvectorised code: 1 mark NB: a loop may be used to loop over the 7 images but the mean calculation, dark frame subtraction, and thresholding must be vectorised for full marks. To save time, you may use the template below to load the seven images and convert the to the double data type for processing. Remember to convert back to uint8 ( ) or scale [0,1] for display with image () . il = double (imread ("IMG_5704. JPG") ) ; i2 = double (imread ("IMG_5703 . JPG") ) ; 13 = double (imread ("IMG_5702. JPG") ) ; i4 = double (imread ("IMG_5701. JPG") ) ; 15 = double (imread ("IMG_5700 . JPG") ) ; i6 = double (imread ("IMG_5699. JPG") ) ; 17 = double (imread ( "IMG_5698 . JPG") ) ;
Write a MATLAB script which processes the result of the previous task with an ans-harp mask algorithm. This algorithm requires the following processing steps: 1. Load the original image and convert it to double [in for processing. 2. Create a copy and blur it. See the Week 1121' lab for a suitable blurring algorithm or research a built—in MATLAE function which performs an image blur. Experiment with the "amount" of blur. 1 mark. 3. Subtract the blurred oopy from the original. This is done by applying the formula 3,- = original - blnrred {2) 4. Scale the intensity of y by some value it. ie: multiply the intensity of each pixel by1 say, [L] or if] or 1m. Experiment with this value. a = i? * a {3i 5. The output image is the blurred and intensity scaled data y plus the original image. 3; = y + original {4] 6. Display the result. A conversion to uintB {1| will clip any negative values or values over 255. You do not need to worry about this clipping. 3 marks for eorrecly implementing steps 3 to E. 1". Compare results between processing the noise-reduced image to an original image. How sure mptible is the urmharp IIlasl-r process to image noise? Does it make the noise worse or suppresa it? 8. Show your demonstrator the result of vowing the parameters {blur amount and sealing of y] and the comparison between a "noisy" image and the "dermised" one. 1 mark for showing that applying the algorithm with a "noisy" input results in ampli?ed noise. This effect is easy to over-do but for demonstration purposes the ?gures below provides an extreme before Er after exiun lo. Normall it is used as a subtle enhancement. not an "obvious" effect. More information about this algorithm. plus examples. can be found on Wiltipedia: ht tps : f f e n . aikipedia . orgr'wiki fUnshaernaskinq