⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lvbo.m

📁 峰值检测
💻 M
字号:
clear;close all;
U=imread('209.png');
I=rgb2gray(U);
imshow(I);
x=1:550; y=50*ones(1,length(x));
A=improfile(I,x,y);
grid on;
B=A(:,1,1);
subplot(221);
imshow(I);
% a=1;
% b=[1/5 1/5 1/5 1/5 1/5];
% C=filter(b,a,B);
%subplot(222);
%plot(C);
%grid on;
%axis([0 400 100 150]);
%grid on;
subplot(222);
plot(B);
axis([0 550 90 200]);
grid on;
%三点平均滤波
for i=2:length(B)-1
    C(i)=(B(i-1)+B(i)+B(i+1))/3;
    C(1)=B(1);
end
subplot(224)
plot(C)
axis([0 550 90 200]);
grid on;
%防脉冲干扰平均值滤波
j=1;
Q=[];
for i=56:65;
     Q(j)=C(i);
     j=j+1;
        end;
          Qmin=min(Q);
          Qmax=max(Q);
          disp(Q);
          disp('Qmax');    
           disp(Qmax);         
          disp('Qmin');    
           disp(Qmin);
S1=sum(Q);
disp(S1);
avg1=(S1-Qmax-Qmin)/(j-3);
disp(avg1);
t=1;          
P=[];         
for i=420:430;
     P(t)=C(i);
     t=t+1;
    end;    
     Pmin=min(P);
     Pmax=max(P);
          disp('Pmax');    
           disp(Pmax);       
     disp('Pmin');
    disp(Pmin);
S2=sum(P);
disp(S2);
avg2=(S2-Pmax-Pmin)/(t-3);
disp(avg2);
%再求比值
z=avg1/avg2;
disp('z=');
disp(z);

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -