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

📄 jiemian.m

📁 b样条插值滤波
💻 M
字号:
function varargout = jiemian(varargin)
% JIEMIAN M-file for jiemian.fig
%      JIEMIAN, by itself, creates a new JIEMIAN or raises the existing
%      singleton*.
%
%      H = JIEMIAN returns the handle to a new JIEMIAN or the handle to
%      the existing singleton*.
%
%      JIEMIAN('CALLBACK',hObject,eventData,handles,...) calls the local
%      function named CALLBACK in JIEMIAN.M with the given input arguments.
%
%      JIEMIAN('Property','Value',...) creates a new JIEMIAN or raises the
%      existing singleton*.  Starting from the left, property value pairs are
%      applied to the GUI before jiemian_OpeningFunction gets called.  An
%      unrecognized property name or invalid value makes property application
%      stop.  All inputs are passed to jiemian_OpeningFcn via varargin.
%
%      *See GUI Options on GUIDE's Tools menu.  Choose "GUI allows only one
%      instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES

% Copyright 2002-2003 The MathWorks, Inc.

% Edit the above text to modify the response to help jiemian

% Last Modified by GUIDE v2.5 25-May-2007 11:56:35

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @jiemian_OpeningFcn, ...
                   'gui_OutputFcn',  @jiemian_OutputFcn, ...
                   'gui_LayoutFcn',  [] , ...
                   'gui_Callback',   []);
if nargin && ischar(varargin{1})
    gui_State.gui_Callback = str2func(varargin{1});
end

if nargout
    [varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
    gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT


% --- Executes just before jiemian is made visible.
function jiemian_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
% varargin   command line arguments to jiemian (see VARARGIN)

% Choose default command line output for jiemian
handles.output = hObject;

% Update handles structure
guidata(hObject, handles);

% UIWAIT makes jiemian wait for user response (see UIRESUME)
% uiwait(handles.figure1);


% --- Outputs from this function are returned to the command line.
function varargout = jiemian_OutputFcn(hObject, eventdata, handles) 
% varargout  cell array for returning output args (see VARARGOUT);
% hObject    handle to figure
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Get default command line output from handles structure
varargout{1} = handles.output;


% --- Executes on button press in pushbutton1.
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

handles=guidata(jiemian);
l=handles.insignal;
prompt={'a1:','a2:','d'};
def={'10','1000','3'};
dlgtitle='choose';
lineno=1;
answer0=inputdlg(prompt,dlgtitle,lineno,def);
a1=str2double(answer0{1});
a2=str2double(answer0{2});
d=str2double(answer0{3});
y=l(a1:a2);
n=length(y);
N=5*n+45;
x=50:5:N;
b=length(x);
w=wden(y,'minimaxi','s','one',d,'sym8');
s0=evalin('base','s0');
s1=evalin('base','s1');
if ((s1==0)&&(s0==1))
  loglog(x,exp(y),'g',x,exp(w),'r') ;
  hold off
elseif((s1==1)&&(s0==0)) 
  loglog(exp(x),y,'g',exp(x),w,'r') 
  hold off
elseif((s1==1)&&(s0==1))
  loglog(x,y,'g',x,w,'r') ;
else
   plot(x,y,'g',x,w,'r');
end
s3=evalin('base','s3');
if s3==1
handles.insignal=w;
guidata(hObject,handles);
else   
hold off
end

% --- Executes on button press in pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

handles=guidata(jiemian);
l=handles.insignal;
prompt={'a1:','a2:'};
def={'10','1000'};
dlgtitle='choose';
lineno=1;
answer0=inputdlg(prompt,dlgtitle,lineno,def);
a1=str2double(answer0{1});
a2=str2double(answer0{2});
a=50;
b=0.005;
y=l(a1:a2);
n=length(y);
N=n+49;
x=50:N;
M=b*n+a-b;
t=a:b:M;
for i=2:n-1
    Y(i)=(y(i-1)+2*y(i)+y(i+1))/4;
    Y(i+1)=2*y(i)-y(i-1);
w=atan(y(i)-Y(i+1)/b);
q(i+1)=y(i)+tan(w/2)*b;
end
q(1)=y(1);
q(2)=Y(2);
s=q;
s0=evalin('base','s0');
s1=evalin('base','s1');
if ((s1==0)&&(s0==1))
  loglog(x,exp(y),'g',x,exp(s),'r') ;
  hold off
elseif((s1==1)&&(s0==0)) 
  loglog(exp(x),y,'g',exp(x),s,'r') 
  hold off
elseif((s1==1)&&(s0==1))
  loglog(x,y,'g',x,s,'r') ;
else
   plot(x,y,'g',x,s,'r');
end
s4=evalin('base','s4');
if s4==1
handles.insignal=s;
guidata(hObject,handles);
else
hold off
end

% --- Executes on button press in pushbutton4.
function pushbutton4_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton4 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

handles=guidata(jiemian);
l=handles.insignal;
prompt={'a1:','a2:','d'};
def={'10','1000','20'};
dlgtitle='choose';
lineno=1;
answer0=inputdlg(prompt,dlgtitle,lineno,def);
a1=str2double(answer0{1});
a2=str2double(answer0{2});
d=str2double(answer0{3});
y=l(a1:a2);
n=length(y);
N=5*n+45;
x1=[50:5:N];
x=x1';
s0=evalin('base','s0');
s1=evalin('base','s1');
if ((s1==0)&&(s0==1))
   pcoef=polyfit(x,y,d);
   xx=50:5:N; 
   yy=polyval(pcoef,xx); 
  loglog(x,exp(y),'g',xx,exp(yy),'r') ;
  hold off
elseif((s1==1)&&(s0==0))
   loglog(x,y,'g');
   pcoef=polyfit(x,y,d);
   xx=50:5:N; 
   yy=polyval(pcoef,xx); 
  loglog(exp(x),y,'g',exp(xx),yy,'r') 
  hold off
elseif((s1==1)&&(s0==1))
   pcoef=polyfit(x,y,d);
   xx=50:5:N; 
   yy=polyval(pcoef,xx); 
  loglog(x,y,'g',xx,yy,'r') ;
else
  pcoef=polyfit(x,y,d);
   xx=50:5:N; 
   yy=polyval(pcoef,xx); 
   plot(x,y,'g');
   hold on
   plot(xx,yy,'r');
end
hold off
s5=evalin('base','s5');
if s5==1
handles.insignal=yy;
guidata(hObject,handles);
else
hold off
end

% --------------------------------------------------------------------
function open_Callback(hObject, eventdata, handles)
% hObject    handle to open (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
[FileName,PathName] = uigetfile('*.dat','Select the dat-file');
l=load(FileName,'r');
handles.insignal=l;
guidata(hObject,handles);




% --- Executes on button press in checkbox1.
function checkbox1_Callback(hObject, eventdata, handles)
% hObject    handle to checkbox1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of checkbox1
if get(hObject,'Value')==0
   s0=0;
   assignin('base','s0',s0);
else
    s0=1;
   assignin('base','s0',s0);
end


% --- Executes on mouse press over axes background.
function axes1_ButtonDownFcn(hObject, eventdata, handles)
% hObject    handle to axes1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)




% --- Executes during object creation, after setting all properties.
function axes1_CreateFcn(hObject, eventdata, handles)
% hObject    handle to axes1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    empty - handles not created until after all CreateFcns called

% Hint: place code in OpeningFcn to populate axes1




% --- Executes on button press in pushbutton6.
function pushbutton6_Callback(hObject, eventdata, handles)
% hObject    handle to pushbutton6 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
cla



% --- Executes on button press in checkbox2.
function checkbox2_Callback(hObject, eventdata, handles)
% hObject    handle to checkbox2 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of checkbox2
if get(hObject,'Value')==0
   s1=0;
   assignin('base','s1',s1);
else
    s1=1;
   assignin('base','s1',s1);
end



% --------------------------------------------------------------------
function save_Callback(hObject, eventdata, handles)
% hObject    handle to save (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
[file,path] = uiputfile('*.dat','Save As');
shili(path, file);
function shili(path, file)
handles=guidata(jiemian);
yy=handles.insignal;
fid = fopen([path,file,'.dat'],'wt');
fprintf(fid,' %15.12f\n',yy);
fclose(fid)
handles=guidata(jiemian);
w=handles.insignal;
fid = fopen([path,file,'.dat'],'wt');
fprintf(fid,' %15.12f\n',w);
fclose(fid)
handles=guidata(jiemian);
s=handles.insignal;
fid = fopen([path,file,'.dat'],'wt');
fprintf(fid,' %15.12f\n',s);
fclose(fid)



% --- Executes on button press in checkbox3.
function checkbox3_Callback(hObject, eventdata, handles)
% hObject    handle to checkbox3 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of checkbox3
if get(hObject,'Value')==0
   s3=0;
   assignin('base','s3',s3);
else
    s3=1;
   assignin('base','s3',s3);
end


% --- Executes on button press in checkbox4.
function checkbox4_Callback(hObject, eventdata, handles)
% hObject    handle to checkbox4 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of checkbox4
if get(hObject,'Value')==0
   s4=0;
   assignin('base','s4',s4);
else
    s4=1;
   assignin('base','s4',s4);
end




% --- Executes on button press in checkbox5.
function checkbox5_Callback(hObject, eventdata, handles)
% hObject    handle to checkbox5 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)

% Hint: get(hObject,'Value') returns toggle state of checkbox5
if get(hObject,'Value')==0
   s5=0;
   assignin('base','s5',s5);
else
    s5=1;
   assignin('base','s5',s5);
end


⌨️ 快捷键说明

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