EE 4780 - PowerPoint PPT Presentation

About This Presentation
Title:

EE 4780

Description:

EE 4780 Matlab tutorial MATLAB Review your matrix-vector knowledge Matlab help files are helpful to learn it Exercise: f = [1 2; 3 4] g = [1; 1] g = [1 1] g z = f ... – PowerPoint PPT presentation

Number of Views:16
Avg rating:3.0/5.0
Slides: 6
Provided by: eceLsuEd
Learn more at: https://www.ece.lsu.edu
Category:

less

Transcript and Presenter's Notes

Title: EE 4780


1
EE 4780
  • Matlab tutorial

2
MATLAB
  • Review your matrix-vector knowledge
  • Matlab help files are helpful to learn it
  • Exercise
  • f 1 2 3 4
  • g 1 1
  • g 1 1
  • g
  • z f g
  • n010
  • plot(sin(n))
  • plot(n,sin(n)) title(Sinusoid) xlabel(n)
    ylabel(Sin(n))
  • n00.110
  • plot(n,sin(n))
  • grid
  • figure subplot(2,1,1) plot(n,sin(n))
    subplot(2,1,2) plot(n,cos(n))

3
MATLAB
  • Some more built-ins
  • a zeros(3,2)
  • b ones(2,4)
  • c rand(3,3) Uniform distribution
  • help rand
  • help randn Normal distribution
  • d1 inv(c)
  • d2 inv(rand(3,3))
  • d3 d1d2
  • d4 d1-d2
  • d5 d1d2
  • d6 d1.d3
  • e d6()

4
MATLAB
  • Image processing in Matlab
  • ximread(cameraman.tif)
  • figure
  • imshow(x)
  • h,wsize(x)
  • yx(0h/2,0w/2)
  • imwrite(y,man.tif)
  • To look for a keyword
  • lookfor resize

5
MATLAB
  • M-file
  • Save the following as myresize1.m
  • function ymyresize1(x)
  • This function downsamples an image by two
  • h,wsize(x)
  • for i1h/2,
  • for j1w/2,
  • y(i,j) x(2i,2j)
  • end
  • end
  • Compare with myresize2.m
  • function ymyresize2(x)
  • This function downsamples an image by two
  • h,wsize(x)
  • for i0h/2-1,
  • for j0w/2-1,
  • y(i1,j1) x(2i1,2j1)
  • end
  • end
  • Compare with myresize3.m
  • function ymyresize3(x)
  • This function downsamples an image by two
  • y x(12end,12end)
  • We can add inputs/outputs
  • function y,height,widthmyresize4(x,factor)
  • Inputs
  • x is the input image
  • factor is the downsampling factor
  • Outputs
  • y is the output image
  • height and width are the size of the output
    image
  • y x(1factorend,1factorend)
  • height,width size(y)
Write a Comment
User Comments (0)
About PowerShow.com