?? matlabzuotu.txt
字號:
'string','開始',...
'backgroundcolor',[0.75 0.75 0.75],...
'position',[30 80 50 20],...
'callback',b1huidiao);
b2=uicontrol('parent',h0,...
'units','points',...
'tag','b2',...
'style','pushbutton',...
'string','停止',...
'backgroundcolor',[0.75 0.75 0.75],...
'position',[100 80 50 20],...
'callback','k=1;');
b3=uicontrol('parent',h0,...
'units','points',...
'tag','b3',...
'style','pushbutton',...
'string','關閉',...
'backgroundcolor',[0.75 0.75 0.75],...
'position',[170 80 50 20],...
'callback',[...
'k=1;,',...
'close']);
s1=uicontrol('parent',h0,...
'units','points',...
'tag','s1',...
'style','slider',...
'value',50*speed,...
'max',1,...
'min',0,...
'backgroundcolor',[0.75 0.75 0.75],...
'position',[30 115 190 20],...
'callback',[...
'm=get(s1,''value'');,',...
'speed=m/50;']);
t1=uicontrol('parent',h0,...
'units','points',...
'tag','t1',...
'style','text',...
'fontsize',15,...
'string','小球運動速度',...
'backgroundcolor',[0.75 0.75 0.75],...
'position',[30 135 190 20]);
實例60:動態文本顯示
h0=figure('toolbar','none',...
'position',[198 56 350 468],...
'name','實例60');
h1=axes('parent',h0,...
'position',[0.25 0.45 0.5 0.5],...
'visible','off');
str1='當前阻尼比=';
z=0.52;
t=0:0.1:10;
y=step(1,[1 2*z 1],t);
hline=plot(t,y);
grid on
r1=uicontrol('parent',h0,...
'units','points',...
'tag','r1',...
'style','radio',...
'string','grid on',...
'position',[30 120 60 20],...
'backgroundcolor',[0.75 0.75 0.75],...
'value',1,...
'callback',[...
'grid on,',...
'set(r1,''value'',1);,',...
'set(r2,''value'',0)']);
r2=uicontrol('parent',h0,...
'units','points',...
'tag','r2',...
'style','radio',...
'string','grid on',...
'position',[30 95 60 20],...
'backgroundcolor',[0.75 0.75 0.75],...
'value',0,...
'callback',[...
'grid off,',...
'set(r2,''value'',1);,',...
'set(r1,''value'',0)']);
s1=uicontrol('parent',h0,...
'units','points',...
'tag','s1',...
'style','slider',...
'value',z,...
'position',[100 95 150 20],...
'backgroundcolor',[0.75 0.75 0.75],...
'max',1,...
'min',0,...
'callback',[...
'z=get(s1,''value'');,',...
'set(t1,''string'',[str1,sprintf(''%1.4g\'',z)]);,',...
'delete(hline),',...
'y=step(1,[1 2*z 1],t);,',...
'hline=plot(t,y);,',...
'if get(r1,''value'')==1,',...
'grid on,',...
'end,',...
'if get(r2,''value'')==1,',...
'grid off,',...
'end']);
t1=uicontrol('parent',h0,...
'units','points',...
'tag','t1',...
'style','text',...
'string',[str1,sprintf('%1.4g\',z)],...
'position',[100 120 150 20],...
'backgroundcolor',[0.75 0.75 0.75]);
b1=uicontrol('parent',h0,...
'units','points',...
'tag','b1',...
'style','pushbutton',...
'string','關閉',...
'position',[80 50 80 30],...
'backgroundcolor',[0.75 0.75 0.75],...
'fontsize',15,...
'callback','close');
'callback','close');
實例69:圖像的頻率操作
h0=figure('toolbar','none',...
'position',[198 56 350 468],...
'name','頻率操作');
h1=axes('parent',h0,...
'position',[0.3 0.45 0.5 0.5],...
'visible','off');
b=remez(10,[0 0.4 0.6 1],[1 1 0 0]);
h=ftrans2(b);
[H,W]=freqz(b,1,64,'whole');
colormap(jet(64))
plot(W/pi-1,fftshift(abs(H)))
b1=uicontrol('parent',h0,...
'units','points',...
'tag','b1',...
'backgroundcolor',[0.75 0.75 0.75],...
'style','pushbutton',...
'string','頻率變換',...
'position',[30 100 50 20],...
'callback',[...
'cla,',...
'b=remez(10,[0 0.4 0.6 1],[1 1 0 0]);,',...
'h=ftrans2(b);,',...
'[H,W]=freqz(b,1,64,''whole'');,',...
'colormap(jet(64)),',...
'freqz2(h,[32 32])']);
b2=uicontrol('parent',h0,...
'units','points',...
'tag','b2',...
'backgroundcolor',[0.75 0.75 0.75],...
'style','pushbutton',...
'string','頻率采樣一',...
'position',[100 100 50 20],...
'callback',[...
'cla,',...
'Hd=zeros(11,11);,',...
'Hd(4:8,4:8)=1;,',...
'[f1,f2]=freqspace(11,''meshgrid'');,',...
'mesh(f1,f2,Hd),',...
'axis([-1 1 -1 1 0 1.2]),',...
'colormap(jet(64))']);
b3=uicontrol('parent',h0,...
'units','points',...
'tag','b3',...
'backgroundcolor',[0.75 0.75 0.75],...
'style','pushbutton',...
'string','頻率采樣二',...
'position',[170 100 50 20],...
'callback',[...
'cla,',...
'Hd=zeros(11,11);,',...
'Hd(4:8,4:8)=1;,',...
'H=fsamp2(Hd);,',...
'freqz2(h,[32 32]),',...
'axis([-1 1 -1 1 0 1.2]),',...
'colormap(jet(64))']);
b4=uicontrol('parent',h0,...
'units','points',...
'tag','b4',...
'backgroundcolor',[0.75 0.75 0.75],...
'style','pushbutton',...
'string','關閉',...
'fontsize',15,...
'position',[80 50 80 30],...
'callback','close');
實例70:函數變換
h0=figure('toolbar','none',...
'position',[198 56 350 468],...
'name','函數變換');
h1=axes('parent',h0,...
'position',[0.25 0.45 0.5 0.5],...
'visible','off');
I=imread('cameraman.tif');
imshow(I)
b1=uicontrol('parent',h0,...
'units','points',...
'tag','b1',...
'backgroundcolor',[0.75 0.75 0.75],...
'style','pushbutton',...
'string','圖像壓縮',...
'position',[30 100 50 20],...
'callback',[...
'cla,',...
'I=imread(''cameraman.tif'');,',...
'I2=im2double(I);,',...
'imshow(I2)']);
b2=uicontrol('parent',h0,...
'units','points',...
'tag','b2',...
'backgroundcolor',[0.75 0.75 0.75],...
'style','pushbutton',...
'string','圖像解壓',...
'position',[100 100 50 20],...
'callback',[...
'cla,',...
'I=imread(''cameraman.tif'');,',...
'I=im2double(I);,',...
'T=dctmtx(8);,',...
'B=blkproc(I,[8 8],''P1*x*P2'',T,T'');,',...
'mask=[1 1 1 1 0 0 0 0;,',...
'1 1 1 0 0 0 0 0;,',...
'1 1 0 0 0 0 0 0;,',...
'1 0 0 0 0 0 0 0;,',...
'0 0 0 0 0 0 0 0;,',...
'0 0 0 0 0 0 0 0;,',...
'0 0 0 0 0 0 0 0;,',...
'0 0 0 0 0 0 0 0];,',...
'B2=blkproc(B,[8 8],''P1.*x'',mask);,',...
'I2=blkproc(B2,[8 8],''P1*x*P2'',T'',T);,',...
'imshow(I2)']);
b3=uicontrol('parent',h0,...
'units','points',...
'tag','b3',...
'backgroundcolor',[0.75 0.75 0.75],...
'style','pushbutton',...
'string','線條解析',...
'position',[170 100 50 20],...
'callback',[...
'cla,',...
'I=imread(''cameraman.tif'');,',...
'BW=edge(I);,',...
'imshow(BW)']);
b4=uicontrol('parent',h0,...
'units','points',...
'tag','b4',...
'backgroundcolor',[0.75 0.75 0.75],...
'style','pushbutton',...
'string','關閉',...
'fontsize',15,...
'position',[80 50 80 30],...
'callback','close');
實例71:RADON函數變換
h0=figure('toolbar','none',...
'position',[198 56 350 468],...
'name','實例71');
h1=axes('parent',h0,...
'position',[0.3 0.45 0.5 0.5],...
'visible','off');
P=phantom(256);
imshow(P)
b1=uicontrol('parent',h0,...
'units','points',...
'tag','b1',...
'style','pushbutton',...
'string','變換一',...
'backgroundcolor',[0.75 0.75 0.75],...
'position',[30 100 50 20],...
'callback',[...
'cla,',...
'k=1;,',...
'theta1=0:10:170;,',...
'R1=radon(P,theta1);,',...
'imagesc(R1),',...
'colormap(hot),',...
'colorbar']);
b2=uicontrol('parent',h0,...
'units','points',...
'tag','b2',...
'style','pushbutton',...
'string','變換二',...
'backgroundcolor',[0.75 0.75 0.75],...
'position',[100 100 50 20],...
'callback',[...
'cla,',...
'k=2;,',...
'theta2=0:5:175;,',...
'R2=radon(P,theta2);,',...
'imagesc(R2),',...
'colormap(hot),',...
'colorbar']);
b3=uicontrol('parent',h0,...
'units','points',...
'tag','b3',...
'style','pushbutton',...
'string','變換三',...
'backgroundcolor',[0.75 0.75 0.75],...
'position',[170 100 50 20],...
'callback',[...
'cla,',...
'k=3;,',...
'theta3=0:2:178;,',...
'R3=radon(P,theta3);,',...
'imagesc(R3),',...
'colormap(hot),',...
'colorbar']);
b4=uicontrol('parent',h0,...
'units','points',...
'tag','b4',...
'style','pushbutton',...
'string','原始圖像',...
'backgroundcolor',[0.75 0.75 0.75],...
'position',[50 50 70 30],...
'callback',[...
'cla,',...
'if k==1,',...
'I1=iradon(R1,10);,',...
'imshow(I1),',...
'end,',...
'if k==2,',...
'I2=iradon(R2,5);,',...
'imshow(I2),',...
'end,',...
'if k==3,',...
'I3=iradon(R3,2);,',...
'imshow(I3),',...
'end']);
b5=uicontrol('parent',h0,...
'units','points',...
'tag','b5',...
'style','pushbutton',...
'string','關閉',...
'backgroundcolor',[0.75 0.75 0.75],...
'position',[150 50 70 30],...
'callback','close');
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -