-
Notifications
You must be signed in to change notification settings - Fork 2
/
demo2.m
81 lines (74 loc) · 1.87 KB
/
demo2.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
%% demo
%% Code By He Liu (aresmiki@163.com)
clc
clear all
close all
addpath('./minFunc');
N=5000;
Fs=10000; % sampling frequency
fts=[0:1:N-1]*Fs/N;
t=[0:1:N-1]/Fs;
load('sim_fault.mat');
load('sim_noise.mat');
sx1=sim_fault+0.4*sim_noise;
%%
close all
[optWQ,recQ,obj,optWQ2,recQ2,obj2]=min_lplq_optimation(sx1,100,5,1,2);
fts1=(0:length(recQ)-1)*Fs/length(recQ);
NN=length(recQ);
figure
plot(t(1:NN),recQ,'LineWidth',1)
ylabel('Amplitude','fontsize',12)
xlabel('Time (s)','fontsize',12)
set(gca,'linewidth',1);
set(gca,'FontSize',12);
set(gcf,'position',[200,300,aa,bb]);
ylim([-6,6])
yticks([-6:3:6])
figure
plot(fts1,abs(fft(((recQ))))*2/length(recQ),'LineWidth',1)
ylabel('Amplitude','fontsize',12)
xlabel('Frequency (Hz)','fontsize',12)
set(gca,'linewidth',1);
set(gca,'FontSize',12);
set(gcf,'position',[200,300,aa,bb]);
figure
plot(fts1,abs(fft(abs(hilbert(recQ))))*2/length(recQ),'LineWidth',1)
ylabel('Amplitude','fontsize',12)
xlabel('Frequency (Hz)','fontsize',12)
set(gca,'linewidth',1);
set(gca,'FontSize',12);
set(gcf,'position',[200,300,aa,bb]);
xlim([0,400]);
ylim([0,0.4])
fts1=(0:length(recQ2)-1)*Fs/length(recQ2);
NN=length(recQ2);
figure
plot(t(1:NN),recQ2,'LineWidth',1)
ylabel('Amplitude','fontsize',12)
xlabel('Time (s)','fontsize',12)
set(gca,'linewidth',1);
set(gca,'FontSize',12);
set(gcf,'position',[200,300,aa,bb]);
ylim([-6,6])
yticks([-6:3:6])
figure
plot(fts1,abs(fft(((recQ2))))*2/length(recQ2),'LineWidth',1)
ylabel('Amplitude','fontsize',12)
xlabel('Frequency (Hz)','fontsize',12)
set(gca,'linewidth',1);
set(gca,'FontSize',12);
set(gcf,'position',[200,300,aa,bb]);
figure
plot(fts1,abs(fft(abs(hilbert(recQ2))))*2/length(recQ2),'LineWidth',1)
ylabel('Amplitude','fontsize',12)
xlabel('Frequency (Hz)','fontsize',12)
set(gca,'linewidth',1);
set(gca,'FontSize',12);
set(gcf,'position',[200,300,aa,bb]);
xlim([0,400]);
ylim([0,0.4])
figure
plot(obj)
hold on
plot(obj2)