ʵÑé1 MatlabµÄ»ù±¾Ó¦ÓÃ
Ò»¡¢ÊµÑéÄ¿µÄ
1¡¢ ÕÆÎÕMATLABÈí¼þµÄ»ù±¾Ê¹Ó÷½·¨¡£
2¡¢ ÕÆÎÕ±äÁ¿ºÍÎļþÃûµÄÃüÃû¹æÔòÒÔ¼°MÎļþ±à¼Æ÷µÄ»ù±¾Ê¹Ó÷½·¨¡£ 3¡¢ ѧ»áʹÓÃMATLABµÄ°ïÖúϵͳ¡£
4¡¢ ÕÆÎÕÊý×éµÄ¹¹Ôì·½·¨ºÍÊý×é¡¢¾ØÕóµÄËÄÔòÔËËã¡£ 5¡¢ ÕÆÎÕ»æͼ³£Óú¯ÊýµÄʹÓá£
6¡¢ ÕÆÎÕ¼òµ¥µÄ½Å±¾ÎļþºÍº¯ÊýÎļþµÄ±àд¼°µ÷ÊÔ·½·¨¡£
¶þ¡¢ÊµÑéÄÚÈÝÓëÒªÇó
1. ÒÑÖªu?1£¬v?3£¬ÓÃMATLAB·Ö±ðÖ´ÐÐÏÂÁÐÓï¾ä¡£²¢ÔÚʵÑ鱨¸æÖмǼÓï¾äºÍ½á¹û¡£
2v?24u42v3?v a. b. c. d.2333v3v?u?u?v? ×¢Ò⣺±äÁ¿ÃûµÄÃüÃû¹æÔò¡£
2. ÔÚMÎļþ±à¼Æ÷Öбàд³ÌÐò»³öº¯Êýy?2e?0.2xµÄͼÐΣ¬ÒªÇó±ê×¢Ïà¹ØÐÅÏ¢£¨Èç±êÌâ¡¢ºá×ø±ê¡¢×Ý×ø±êµÈ£©ÒÔÔö¼ÓͼÐεĿɶÁÐÔ¡£
3. ¹¹ÔìÊý×é²¢»Ø´ðÒÔÏÂÖ¸ÁîÔËÐкóµÄ½á¹ûÊÇʲô¡£ÔÚʵÑ鱨¸æÖÐÁгö·½·¨ºÍ½á¹û
?1.1?3.23.40.6??
A??0.61.1?0.63.1???0??1.30.65.5?
£¨1£©Çó¾ØÕóAµÄ´óС£¬£¨Ìáʾ£ºº¯Êýsize)¡£²¢»Ø´ðËüÓëlength(A)µÄÇø±ðÊÇʲô£¿
£¨2£©A(:, 3) A(3, :) A£¨2£¬3£© A£¨2£ºend,:£© A(1,[1 3]) (3 ) ÁгöÊý×éAÖÐËù°üº¬µÄÊýÖµ0.6µÄϱꡣÌáʾ£ºÓú¯Êýfind¡£ £¨4£©A£¨1£º2,[1 4]£©=[20 21; 22 23]
4. ¹¹ÔìÒÔÏÂÊý×é²¢»Ø´ðÒÔϱí´ïʽµÄ½á¹ûÊÇʲô¡£ÔÚʵÑ鱨¸æÖÐÁгö·½·¨ºÍ½á¹û
?2?2??1?1? a??b???02?
?12????- 1 -
?1?c??? d?eye(2)
??2? £¨1£©r = a + b; £¨2£©r = a * d; £¨3£©r = a .* d; £¨4£©r = a * c; £¨5£©r = a .* c; £¨6£©r = a \\ b; £¨7£©r = a .\\ b; £¨8£©r = a .^ b; £¨9£©r=a.*[c c]
5. ÔËÐÐÏÂÁÐÓï¾ä£¬»Ø´ðÒÔÏÂÃüÁîÔËÐеĽá¹û¡£
round(3.4) ceil(3.4) floor(3.4) round(3.5) ceil(3.5) floor(3.5) fix(3.5) round(-3.4) ceil(-3.4) floor(-3.4) round(-3.5) ceil(-3.5) floor(-3.5) fix(3.4)
fix(-3.4)
fix(-3.5)
Mod (12,5) Rem (12,5) Mod (-12,5) Rem (-12,5) »Ø´ðÕ⼸¸öº¯ÊýµÄ×÷Ó㬲¢±È½ÏËüÃÇÖ®¼äµÄÇø±ð¡£
6. ±àд½Å±¾Îļþ¡£ÊäÈëÒ»×éÊý¾Ý£¨Êý¾Ý¿ÉΪÕý¡¢¸º»òÁ㣩£¬¸ù¾ÝÒÔϹ«Ê½¼ÆËãÆäƽ¾ùÖµºÍ±ê×¼·½²î¡££¨×¢£º²ÉÓÃforÑ»·£©
1x?N?xi?1Ni
×¢Ò⣺ѧϰ³ÌÐòµÄµ÷ÊÔ·½·¨¡£
7. £¨Ñ¡×ö£©±àдº¯ÊýÎļþ£¬Í¨¹ýÊäÈ벻ͬµÄx,yÖµ£¬¸ù¾ÝÒÔϹ«Ê½¼ÆËãf(x,y)µÄÖµ²¢ÏÔʾ¡£
?x?yx?0,y?0?x?y2x?0,y?0? f(x,y)??2?x?yx?0,y?022?x?0,y?0?x?y
×¢Ò⣺º¯ÊýÎļþµÄ±àд¸ñʽºÍµ÷Ó÷½·¨¡£
- 2 -
ʵÑé2 ÐòÁеÄʱÓò±íʾÓëÔËËã
Ò»¡¢ÊµÑéÄ¿µÄ
1. ÕÆÎÕÀëɢʱ¼äÐźŵıíʾ£»
2. ÕÆÎÕÀëɢʱ¼äÐźŵĻù±¾ÔËË㣨¼Ó¡¢¼õ¡¢³Ë¡¢·´ÕÛ¡¢ÒÆ룩µÄ¹æÔò£» 3. ÄÜÓÃMATLAB½øÐмòµ¥µÄ±à³Ì£»
4. ѧϰMATLABº¯ÊýµÄµ÷Óã¬ÊµÏÖÐòÁеÄÏÔʾºÍÔËËã¡£
¶þ¡¢ÊµÑéÄÚÈÝÓëÒªÇó
ÇëÔÚʵÑ鱨¸æÖмǼÒÔϳÌÐòºÍ½á¹û
1£®ÓÃMATLAB²úÉú²¢»³öÏÂÁÐÐòÁеÄÑù±¾¡£
1)
x1(n)???m?1?[??n?2m????n?2m?1?],0?n?25
m?02n102) x2(n)?n[u?n?5??u?n?6?]?10??n??20?0.5?[u?n?4??u?n?10?] 3) x3(n)??0.9?cos(0.2?n??/3),0?n?20 4)
nx4(n)?10cos(0.0008?n2)?w?n?,0?n?100£¬Ê½ÖÐw?n?ÊÇÔÚ[-1£¬1]Ö®¼ä¾ùÔÈ·Ö
²¼µÄËæ»úÐòÁÐ;
2. ѧϰº¯ÊýµÄµ÷Óá£Éèx(n)?{1,2,3,4,5,6,7,6,5,4,3,2,1}£¬Çó½â²¢»³öÏÂÃæÐòÁС£
? y1(n)?2x(n?5)?3x(n?4) y2(n)?x(3?n)?x(n)x(n?2) 3. ÒÑÖªÐòÁÐx[n]?e(?0.1?j0.3)n?10?n?10 £¬ÔÚÒ»¸öͼÐδ°Öзֱð»³ö¸ÃÐòÁеÄ
ʵ²¿¡¢Ð鲿¡¢·ùÖµºÍÏàλͼ¡£
×¢£ºÑ§Ï°abs¡¢angle¡¢real¡¢imag¡¢subplot¡¢titleº¯ÊýµÄʹÓá£
4. ÈôÏßÐÔʱ²»±äϵͳµÄµ¥Î»ÑùÖµÏìӦΪh(n)?(0.6)nu(n)£¬ÊäÈëÐòÁÐ
x(n)?u(n)?u(n?10)£¬ÇóϵͳµÄÊä³öy(n)£¬²¢»³öÆ䲨ÐÎͼ¡£(˼¿¼£ºÄã¿ÉÒÔÓü¸ÖÖ
·½·¨À´ÊµÏÖ£¿)
- 3 -
Èý¡¢ÊµÑéËùÓò¿·Öº¯ÊýÈçÏÂ
1.µ¥Î»³å¼¤ÐòÁУ¨Ðźţ©Éú³Éº¯Êýimpseq [x,n] = impseq(n0,n1,n2)
2.½×Ô¾ÐòÁУ¨Ðźţ©Éú³Éº¯Êýstepseq [x,n] = stepseq(n0,n1,n2) 3.ÐòÁУ¨Ðźţ©Ïà¼Óº¯Êýsigadd [y,n] = sigadd(x1,n1,x2,n2)
ÒÔÉÏΪMATLABûÓУ¬ÐèÍâ¼ÓÈëµÄº¯Êý£¨½«ÏàÓ¦º¯Êý¿½±´µ½×Ô¼ºµ±Ç°Ä¿Â¼Ï£© 4. Õý£¨ÓࣩÏÒÉú³Éº¯Êýsin¡¢cos
y = sin(x) ,y = cos(x) (×¢Òâ:xÒÔ»¡¶ÈΪµ¥Î») 5. Ëæ»úÐòÁÐÉú³Éº¯Êýrand£¬Ó÷¨È磺
Y = rand (n) Éú³Én¡Án½×µÄ¾ùÔÈ·Ö²¼Ëæ»úÕó£» Y = rand (m, n) Éú³Ém¡Án½×µÄËæ»úÕó£»
rand ·µ»ØÔÚ[0£¬1]Çø¼äÉϵÄÒ»¸öËæ»úÊý£»
½«ÉÏÃæµÄrandд³ÉrandnÔò¿ÉÒÔÉú³É¾ùֵΪ0¡¢·½²îΪ1µÄÕý̬·Ö²¼µÄËæ»ú±äÁ¿¡£ 6£®È«1¾ØÕóÉú³Éº¯Êýones (m, n) £ºÉú³Ém¡Án½×È«1¾ØÕó 7£®È«0¾ØÕóÉú³Éº¯Êýzeros (m, n) £ºÉú³Ém¡Án½×È«0¾ØÕó 8£®ÀëÉ¢ÐòÁлæͼº¯Êýstem
stem (y) ÒÔ1¡¢2¡¢3¡Îªºá×ø±ê£¬ yΪ×Ý×ø±ê»¸ËÐÎͼ£»
stem(x, y) ÒÔxΪºá×ø±ê£¬ yΪ×Ý×ø±ê»¸ËÐÎͼ(xÓëyÊý¾Ý¸öÊý±ØÐëÒ»ÖÂ)£» stem (¡,¡¯fill¡¯) Ñ¡Ïfill¡¯Ö¸¶¨¸Ë¶¥ÎªÊµÐÄ£¬ÈôÎÞ´ËÑ¡ÏîÔòĬÈÏ¿ÕÐÄ¡£ 9£®ÏßÐÔ×ø±êƽÃæ»æͼº¯Êýplot
Ó÷¨Óëstem ÀàËÆ£¬¾ßÌåÓ÷¨¿É²é¿´MATLAB°ïÖú ÒÔÉÏΪMATLABÄÚÖú¯Êý£¨Ôڴ˽öΪͬѧ¸´Ï°MATLABÌṩ£©
ËÄ¡¢²Î¿¼³ÌÐò
1.µäÐÍÐòÁк¯Êý
1£©µ¥Î»½×Ô¾º¯Êý£¨the step sequence£©
function [x,n] = stepseq(n0,n1,n2)
% Generates x(n) = u(n-n0); n1 <= n,n0 <= n2 % ------------------------------------------ % [x,n] = stepseq(n0,n1,n2)
- 4 -