close all
web -browser http://www.ilovematlab.cn/thread-12052-1-1.html
rectangle('position',[12,8,2,0.3],'FaceColor',[0.1,0.3,0.4]);
axis([0,15,-1,10]);hold on
plot([13,13],[7,8],'r','linewidth',2);
y=2:.2:7;M=length(y);
x=12+mod(1:M,2)*2;
x(1)=13;x(end-3:end)=13;
D=plot(x,y); % ??[??]
% Author's email:zjliu2001@163.com
C=0:.1:2*pi;r=0.3;
t1=r*sin(C);
F1=fill(13+r*cos(C),2+t1,'r'); % ??[?]
set(gca,'ytick',[0:2:9]);
set(gca,'yticklabels',num2str([-1:3]'));
plot([0,15],[2,2],'black');
H1=plot([0,13],[2,2],'g'); % ??[??]
Q=plot(0,2.5,'color','r'); % ????;
td=[];yd=[];
T=0;
text(2,8,'damp osillation','fontsize',24);
set(gcf,'doublebuffer','on');
while T<12;
pause(0.2);
Dy=1-0.5*exp(-T/4)*cos(pi*T);
Y=-(y-2)*Dy+7;
Yf=Y(end)+t1;
td=[td,T];yd=[yd,Y(end)];
set(D,'ydata',Y);
set(F1,'ydata',Yf,'facecolor',rand(1,3));
set(H1,'xdata',[T,13],'ydata',[Y(end),Y(end)]);
set(Q,'xdata',td,'ydata',yd)
T=T+0.1;
end
Kd=find(diff(sign(diff(yd)))==-2)+1;
X=td(Kd);Y=yd(Kd);
X=[0,X,td(end)];
Y=[yd(1),Y,yd(end)];
plot(X,Y,':');
Kx=find(diff(sign(diff(yd)))==2)+1;
X=td(Kx);Y=yd(Kx);
X=[0,X,td(end)];
Y=[-(yd(1)-4),Y,-(yd(end)-4)];
plot(X,Y,':');
weixin_39841848
- 粉丝: 511
- 资源: 1万+
最新资源
- 代码调试工具gdb指令
- 数据库工具redis-desktop-manager、wiindow安装 Redis-x64-3.0.504
- JavaScript中的`reduce`方法:精解与实战应用
- 46YW-VB一款N-Channel沟道SOT23-6的MOSFET晶体管参数介绍与应用说明
- 如何在C++中实现代码安全性分
- QQ陌生空间留站苹助手
- 446W-VB一款N-Channel沟道SOT23-6的MOSFET晶体管参数介绍与应用说明
- 数据库工具navicat15
- Vue3+ts+threejs实现360度VR全景
- 4451GH-HF-VB一款P-Channel沟道TO252的MOSFET晶体管参数介绍与应用说明
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈