您好,登錄后才能下訂單哦!
本篇內(nèi)容主要講解“matlab曲線折疊怎么實現(xiàn)”,感興趣的朋友不妨來看看。本文介紹的方法操作簡單快捷,實用性強。下面就讓小編來帶大家學(xué)習(xí)“matlab曲線折疊怎么實現(xiàn)”吧!
曲線折疊
clear ;
close all;
%正常繪圖
x=0:0.005:5;
y=exp(-6*x).*sin(x*40)*6+exp(5*x)*5e-11.*sin(x*20);
figure(1)
for i=1:2
a(i)=subplot(2,1,i);
title('Before');
plot(x,y,x,y+2,'o');
grid on;
title('Before');
legend('a','a+2');
xlim([0 5]);
end
drawnow;
cutout(a(2),1,4,0.2);
%將a(2)的1到4部分折疊為長度0.2的虛線段
title('After');
折疊曲線的函數(shù)
function cutout(axes_handle,Start,End,Gap)
xt=axes_handle.XTick;
xl=axes_handle.XLim;
p=allchild(axes_handle);
px={p.XData};
py={p.YData};
leg=findobj(axes_handle.Parent,'Tag','legend');
[leg.AutoUpdate]=deal('off');
kolor={p.Color};
hold on;
for i=1:length(p)
p(i).XData=px{i}(1:find(px{i}>=Start,1));
p(i).YData=py{i}(1:find(px{i}>=Start,1));
x{i}=px{i}(find(px{i}>=End,1):end)-End+Start+Gap;
y{i}=py{i}(find(px{i}>=End,1):end);
pl(i,:)=plot(x{i},y{i},[p(i).XData(end) x{i}(1)],[p(i).YData(end) y{i}(1)],...
'Color',kolor{i});
pl(i,2).LineStyle=':';
pl(i,1).Marker=p(i).Marker;
pl(i,1).MarkerSize=p(i).MarkerSize;
pl(i,1).LineWidth=p(i).LineWidth;
end
hold off;
xta=xt(1:find(xt>=Start));
xta(end)=Start;
xtb=xt(find(xt>End):end);
xtb=[End xtb];
xtL=[xta xtb];
xt2=[xta xtb-End+Start+Gap];
axes_handle.XTick=xt2;
axes_handle.XTickLabel=xtL;
axes_handle.XLim=[xl(1) xl(2)-End+Start+Gap];
到此,相信大家對“matlab曲線折疊怎么實現(xiàn)”有了更深的了解,不妨來實際操作一番吧!這里是億速云網(wǎng)站,更多相關(guān)內(nèi)容可以進(jìn)入相關(guān)頻道進(jìn)行查詢,關(guān)注我們,繼續(xù)學(xué)習(xí)!
免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。