📄 tp0.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=iso-8859-1"><link rel=File-List href="index_files/filelist.xml"><title>Lecture 0 - Basic Matlab Instructions</title><link href="styles.css" rel="stylesheet" type="text/css"></head><body bgcolor="#FFFFFF" lang=FR><div > <h1>Lecture 0 - Basic Matlab Instructions</h1></div><blockquote> <blockquote> <blockquote> <blockquote> <blockquote> <div align="justify" ><strong>Abstract : </strong>Learn the basic features of Matlab, and learn how to load and visualize signals and images.</div> </blockquote> </blockquote> </blockquote> </blockquote></blockquote><h2> Basic Matlab commands. </h2><ul> <li>Create a variable and an array</li> <blockquote> <p><font face="Courier New, Courier, mono">% this is a comment<br> a = 1; a = 2+1i; % real and complex numbers<br> b = [1 2 3 4]; % row vector<br> c = [1; 2; 3; 4]; % column vector<br> d = 1:2:7; % here one has d=[1 3 5 7]<br> A = eye(4); B = ones(4); C = rand(4); % identity, 1 and random matrices<br> c = b'; % transpose</font></p> </blockquote> <li>Modification of vectors and matrices</li> <blockquote> <p><font face="Courier New, Courier, mono">A(2,2) = B(1,1) + b(1); % to access an entry in a vector or matrix<br> b(1:3) = 0; % to access a set of indices in a matrix<br> b(end-2:end) = 1: % to access the last entries<br> b = b(end:-1:1); % reverse a vector<br> b = sort(b); % sort values<br> b = b .* (b>2); % set to zeros (threshold) the values below 2<br> b(3) = []; % suppress the 3rd entry of a vector<br> B = [b; b]; % create a matrix of size 2x4<br> c = B(:,2); % to access 2nd column</font></p> </blockquote> <li>Advanced instructions</li> <blockquote> <p><font face="Courier New, Courier, mono">a = cos(b); a = sqrt(b); % usual function <br> help perform_wavelet_transform; % print the help<br> a = abs(b); a = real(b); a = imag(b); a = angle(b); % norm, real part and imaginary part of a complex<br> disp('Hello'); % display a text<br> disp( sprintf('Value of x=%.2f', x) ); % print a values with 2 digits<br> A(A==Inf) = 3; % replace Inf values by 3<br> A(:); % flatten a matrix into a column vector<br> max(A(:)); % max of a matrix<br> M = M .* (abs(M)>T); % threshold to 0 values below T.</font></p> </blockquote> <li>Display</li> <blockquote> <p><font face="Courier New, Courier, mono">plot( 1:10, (1:10).^2 ); % display a 1D function<br> title('My title'); % title<br> xlabel('variable x'); ylabel('variable y'); % axis<br> subplot(2, 2, 1); % divide the screen in 2x2 and select 1st quadrant</font></p> </blockquote> <li>Programmation</li> <blockquote> <p><font face="Courier New, Courier, mono">for i=1:4 % repeat the loop for i=1, i=2, i=3 et i=4<br> </font><font face="Courier New, Courier, mono"> disp(i); % make here something<br> end<br> i = 4;<br> while i>0 % while syntax<br> </font><font face="Courier New, Courier, mono"> disp(i); % do smth<br> i = i-1;<br> end</font></p> </blockquote></ul><h2>Load and visualize signals and images</h2><ul> <li>Load and plot a signal: (function <font face="Courier New, Courier, mono">load_signal.m</font> should be in the toolbox of each course)<a href="MakeSignal.m"></a></li> <blockquote> <p><font face="Courier New, Courier, mono">f = load_signal('Piece-Regular', n); % signal of size n<br> plot(f);</font></p> </blockquote> <li>Load and display an image (download function <font face="Courier New, Courier, mono">load_image.m</font> should be in the toolboxes)</li> <blockquote> <p><font face="Courier New, Courier, mono">I </font><font face="Courier New, Courier, mono"> = load_image('lena');<br> imagesc(I); axis image; colormap gray(256);</font></p> </blockquote></ul><br/><br/>Copyright © 2006 <a href="http://www.ceremade.dauphine.fr/%7Epeyre/">Gabriel Peyré</a></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -