当前位置:网站首页>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 ?“
边栏推荐
- Research Report on market supply and demand and strategy of Chinese hospital cleaning chemicals industry
- C4D quick start tutorial - creating models
- MATLAB实例:阶跃函数的两种表达方式
- 学习记录:使用STM32外部输入中断
- LeetCode#412. Fizz Buzz
- Unpleasant error typeerror: cannot perform 'ROR_‘ with a dtyped [float64] array and scalar of type [bool]
- STM32學習記錄:輸入捕獲應用
- ArrayList集合
- Accounting regulations and professional ethics [5]
- JS --- detailed explanation of JS DOM (IV)
猜你喜欢
STM32学习记录:玩转按键控制蜂鸣器和LED
Learning records: serial communication and solutions to errors encountered
JS --- detailed explanation of JS DOM (IV)
差分(一维,二维,三维) 蓝桥杯三体攻击
JS --- BOM details of JS (V)
Crawler series of learning while tapping (3): URL de duplication strategy and Implementation
C语言是低级和高级的分水岭
Learning record: understand systick system timer and write delay function
Introduction to safety testing
The wechat red envelope cover designed by the object is free! 16888
随机推荐
学习记录:TIM—基本定时器
F - Birthday Cake(山东省赛)
Preface to the foundations of Hilbert geometry
Hospital privacy screen Industry Research Report - market status analysis and development prospect forecast
Learning record: Tim - Basic timer
Market trend report, technical innovation and market forecast of lip care products in China and Indonesia
Research Report on medical anesthesia machine industry - market status analysis and development prospect prediction
Research Report on market supply and demand and strategy of China's medical chair industry
入门C语言基础问答
Es6---es6 content details
Research Report on medical toilet industry - market status analysis and development prospect forecast
STM32学习记录:LED灯闪烁(寄存器版)
Eslint--- error: newline required at end of file but not found (EOL last) solution
Cost accounting [13]
学习记录:USART—串口通讯
Learning record: Tim - capacitive key detection
Medical colposcope Industry Research Report - market status analysis and development prospect forecast
LeetCode#36. Effective Sudoku
The most detailed postman interface test tutorial in the whole network. An article meets your needs
VS2019初步使用