当前位置:网站首页>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 medical toilet industry - market status analysis and development prospect forecast
- What is "test paper test" in software testing requirements analysis
- 基于485总线的评分系统
- Cost accounting [14]
- JS --- all knowledge of JS objects and built-in objects (III)
- LeetCode#412. Fizz Buzz
- Learning record: Tim - Basic timer
- LeetCode#118. Yanghui triangle
- Unpleasant error typeerror: cannot perform 'ROR_‘ with a dtyped [float64] array and scalar of type [bool]
猜你喜欢
ucore lab7
JS --- detailed explanation of JS facing objects (VI)
Stm32 dossiers d'apprentissage: saisie des applications
入门C语言基础问答
UCORE LaB6 scheduler experiment report
动态规划前路径问题优化方式
学习记录:TIM—基本定时器
Do you know the advantages and disadvantages of several open source automated testing frameworks?
ucore lab 2
What is "test paper test" in software testing requirements analysis
随机推荐
通俗地理解什么是编程语言
学习记录:如何进行PWM 输出
Research Report on market supply and demand and strategy of China's medical chair industry
LeetCode#118. Yanghui triangle
基于485总线的评分系统
Your wechat nickname may be betraying you
Learning records: serial communication and solutions to errors encountered
Leetcode notes - dynamic planning -day6
动态规划前路径问题优化方式
Research Report on market supply and demand and strategy of Chinese graphic screen printing equipment industry
学习记录:串口通信和遇到的错误解决方法
ucore Lab 1 系统软件启动过程
Cost accounting [21]
Learning record: USART serial communication
VS2019初步使用
STM32如何使用STLINK下载程序:点亮LED跑马灯(库版本)
ArrayList集合
Cost accounting [22]
C语言数组的概念
Printing quality inspection and verification system Industry Research Report - market status analysis and development prospect forecast