当前位置:网站首页>Matlab comprehensive exercise: application in signal and system
Matlab comprehensive exercise: application in signal and system
2022-07-06 15:41:00 【Bitter tea seeds】
List of articles
MATLAB 2018b
Preface
“ dad , The teacher is very satisfied with the spectrum analysis of time domain signals you sent me yesterday , She left new homework again , Please help me find your employee to help me , I'm not very good at .”
Boss kuchazi , He snorted unhappily :“ Can't you learn a little by yourself ? What can you do when you come out in the future ? Just point to me every day and give you every month 50 Ten thousand pocket money , How can you survive like this !”
“ Stop nagging , Stinky old man , Bye-bye , I fooled !”
“ Ah !“ The boss of kuchazi sighed , Then let the female secretary call Xiao Liu to the office .
” Xiao Liu ! The homework you did yesterday , I? , I'm really satisfied , In order to continue to exercise your ability , Here are a few more questions , You did it too ! ah , Not much .“ Kuchazi's boss said with a straight face .
Xiao Liu thought of refusing , When I see the boss's angry face , I dare not open that mouth , Just waxy said :” well , Boss .“
” The document was sent to you , Write it quickly !“ The boss kicked Xiao Liu out of the office .
Xiao Liu returned to his desk , Looking at so many questions , Silently opened CSDN Search for :” How to raise salary with the boss ?“
One 、 Generate numerical signals
utilize MATLAB Generate signals x(t)=cos(10Πt),y(t)=sin(10Πt2)
, Draw the waveform of the signal respectively , And draw a picture to compare the waveforms of the two signals .
The code is as follows , Shown :
>> t=linspace(0,8*pi,100);% establish 0 To 4Π Linearly separated numeric vector of t, Element is 100 individual
>> x=cos(10*pi*t);%x(t) Waveform of ;
>> plot(t,x,'r'),title('x(t) wavy curve '),xlabel('t Numeric vectors ')
>> y=sin(10*pi*t.^2);%y(t) Waveform of ;
>> plot(t,y,'c'),title('y(t) wavy curve '),xlabel('t Numeric vectors ')
>> plot(t,x,'r',t,y,'c')
>> title('x(t) and y(t) Compare ')
>> xlabel('t Numeric vectors ')
1. A separate x Oscillogram of :
2. A separate y Oscillogram of :
3.x(t) Signal waveform and y(t) Compare the signal waveform :
Two 、 The basic operation of the signal
utilize MATLAB Realization signal f1 (t)=sin(πt),f2(t)=sin(10πt) Add and multiply , Try to draw the waveforms of these two signals and their sum and product signals respectively .
The code is as follows , Shown :
>> t=linspace(0,8*pi,100);% establish 0 To 4Π Linearly separated numeric vector of t, Element is 100 individual
>> f1=sin(pi*t);%f1 Signal function expression
>> f2=sin(10*pi*t);%f2 Signal function expression
>> subplot(1,2,1),plot(t,f1,'m'),title('x(t) The waveform curve of ')
>> subplot(1,2,2),plot(t,f2,'w'),title('y(t) The waveform curve of ')
>> f3=f1+f2;
>> format short,f3;
>> plot(t,f3),title('f3 Is the signal and waveform curve ')
>> f4=f1.*f2;
>> plot(t,f4,'m'),title('f4 Is the waveform curve of signal product ')
1.f1、f2 The waveform curve of :
2.f3 Waveform curve of the product sum of two signals
3.f4 Waveform curve of the product of two signals
3、 ... and 、 Convolution operation
use MATLAB Draw out the function 3[u(t+1)-u(t-2)] And exponential function 2e^(-2t) Convolution graph .
The code is as follows , Shown :
>> dt=0.01; t=0:dt:5;
>> f1=3*(u.*(t+1)-u.*(t-2)); subplot(1,3,1), plot(t,f1,'g') ,title(' Gate function waveform curve ')
>> f2=2*exp(-2.*t); subplot(1,3,2), plot(t,f2,'r'),title(' Exponential function waveform curve ')
>> y =conv(f1,f2)*dt;% Call convolution conv() function
>> subplot(1,3,3), plot(dt*([1:length(y)]-1),y,'m'), title(' Convolution curve '),grid % Ignorance t The length of , When drawing t Array setting method
Gate function , Exponential function 、 The convolution waveforms of the two signals are as follows :
Four 、 Fourier series expansion
utilize MATLAB Set the fundamental frequency to 50Hz The square wave expansion of is Fourier series .
The code is as follows , Shown :
>> N = 500; % Take item , And the higher the number of items , The less distorted the waveform .
>> T = 0.02;% The period of the square wave is 0.02;
>> fs = 1/T;% The fundamental frequency of square wave is 50Hz;
>> N_point = 150; % Set the number of sampling points per cycle
>> dt = T/N_point;% step
>> t=1:dt:100*T-dt;% Value range ,” Shoulds not be too large “
>> ft = zeros(1,length(t));
>> %ft For all 0 matrix
>> for n=1:N
an = (2*sin(pi*n) - sin(2*pi*n))/(pi*n);
bn = (1-2*cos(n*pi)+cos(2*pi*n))/(pi*n);
ft = ft + an*cos(n*2*pi*fs*t)+bn*(sin(n*2*pi*fs*t));% Fourier expansion series
end
>> plot(t,ft,'m')
>> title(' The fundamental frequency is 50Hz The square wave expansion of is Fourier series ')
The fundamental frequency is 50Hz The square wave :
The situation of square wave synthesized by each harmonic :
5、 ... and 、 Spectrum analysis
use MATLAB Draw H(s)=s2/((s+1)2+1) Zero of 、 Pole distribution diagram , And draw the impulse response of the system h(n) Waveform and frequency response H(jω) The curve of , Judge whether the system is low-pass 、 qualcomm 、 Bandpass 、 Which kind of band stop ?
The code is as follows , Shown :
>> a = [1 2 2];% Denominator vector
>> b = [1]; % Molecular vector
>> zs=roots(b) % Find the zero point of the system
zs =
Empty 0×1 double Column vector
>> ps=roots(a) % Find the pole of the system
ps =
-1.0000 + 1.0000i
-1.0000 - 1.0000i
>> plot(real(zs), imag(zs), 'go', real(ps), imag(ps), 'mx', 'markersize', 12);
>> grid; legend(' zero ',' pole ');
>>figure(1); pzmap(sys); % Draw the zero pole diagram
>> figure(2);freqs(b, a, w);% Draw the amplitude frequency characteristic curve and phase frequency characteristic curve
>> dn=0.1; n=0:dn:6;%n Value range
>> [r,p,k]=residue( b, a);% Use the pole residue method to find the impact function
>> H=zeros(1,length(n));
>> for i=1:length(a)-1
H=H+r(i)*exp(p(i)*n);% Shock function h(n) General formula of
end
>> plot(n,H); grid; title(' Impulse response H(t)')![ Insert picture description here ](https://img-blog.csdnimg.cn/d25cf9c7d0764f569678bfd9e8288153.png)
>> freqs(b,a,w) % The frequency response of the filter
1. zero 、 Pole diagram :
2. Amplitude frequency characteristic curve and phase frequency characteristic curve :
3. Impulse function H(t):
4. Frequency response H(jω) The curve of :
summary
Xiao Liu finally finished these questions , He stretched himself , Look at the time , It's already night 21:35 了 , After looking at the boss' office, the light has gone out , It is estimated that the boss has gone home to sleep , Send it to him tomorrow . Take another look at the office where there are few people around , Shook his head , Make yourself a cup of coffee , Continue to look at the questions this afternoon :” How to get the boss to give himself a raise ?“
边栏推荐
- STM32 learning record: play with keys to control buzzer and led
- STM32学习记录:玩转按键控制蜂鸣器和LED
- Cost accounting [13]
- ucorelab3
- Your wechat nickname may be betraying you
- LeetCode#198. raid homes and plunder houses
- Eslint--- error: newline required at end of file but not found (EOL last) solution
- Lab 8 文件系统
- Record of force deduction and question brushing
- 用C语言写网页游戏
猜你喜欢
C语言学习笔记
Visual analysis of data related to crawling cat's eye essays "sadness flows upstream into a river" | the most moving film of Guo Jingming's five years
Learning record: USART serial communication
How to build a nail robot that can automatically reply
ucore lab 6
Take you to use wxpy to create your own chat robot (plus wechat interface basic data visualization)
Crawler series (9): item+pipeline data storage
Eslint--- error: newline required at end of file but not found (EOL last) solution
Learning record: use stm32f1 watchdog
ucore lab 6
随机推荐
Cost accounting [14]
Es6--- two methods of capturing promise status as failed
学习记录:STM32F103 时钟系统概述工作原理
通俗地理解什么是编程语言
Visual analysis of data related to crawling cat's eye essays "sadness flows upstream into a river" | the most moving film of Guo Jingming's five years
CSAPP shell lab experiment report
力扣刷题记录
LeetCode#198. raid homes and plunder houses
Do you know the performance testing terms to be asked in the software testing interview?
JS --- all basic knowledge of JS (I)
0-1 knapsack problem (I)
Accounting regulations and professional ethics [5]
The wechat red envelope cover designed by the object is free! 16888
ucore lab7
12306: mom, don't worry about me getting the ticket any more (1)
LeetCode#237. Delete nodes in the linked list
程序员的你,有哪些炫技的代码写法?
LeetCode#204. Count prime
数据在内存中的存储&载入内存,让程序运行起来
Crawling cat's eye movie review, data visualization analysis source code operation instructions