📄 chirp_sine.m
字号:
function [S,A,X,Fs] = Chirp_Sine% Chirp_Sine is used to generate the mixed signal of chirp and sine at 1kHz% Usage:% [S,A,X,Fs] = Chirp_Sine;% Input: none%Output:% * S is the column vectors of original signals% * A is the random mixing matrix% * X is the column vectors of mixed signals% * Fs is the sampling rate%----------------------Main Program----------------------%load chirp.mat;t=[0:size(y,1)-1]'/Fs;Fc=1000;S=[y,sin(2*pi*Fc*t)];A=rand(2);X=S*A; len=200;%pause; %For test only% Note:% *X=S*rand(2) % Oh shit! It is the bug that led to the failure of the algorithm% since the mixing matrice A's used in the process of mixing and % calculating PI are different.% *'len' is the length of of data that is going to be ploted%%----------------This plot subfunction is just for test----------------%%plot_s(S,t,len); function plot_s(S,t,len);figure;subplot(211);%subplot(121);plot(t(1:len),S(1:len,1));ylabel('Orignal Signal S1');xlabel('Time(sec)');subplot(212);%subplot(122);plot(t(1:len),S(1:len,2));ylabel('Orignal Signal S2');xlabel('Time(sec)');% Fs %For test only%pause; %For test only%----------------This plot subfunction is just for test----------------%%plot_x(X,t,len);%function plot_x(X,t,len);figure;subplot(211);plot(t(1:len),X(1:len,1));ylabel('Mixed Signals X1');xlabel('Time(sec)');subplot(212);plot(t(1:len),X(1:len,2));ylabel('Mixed Signals X2');xlabel('Time(sec)');
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -