news 2026/6/15 16:13:58

Matlab学习记录10

作者头像

张小明

前端开发工程师

1.2k 24
文章封面图
Matlab学习记录10

书籍:Matlab实用教程
工具:Matlab2021a

电脑信息:Intel® Xeon® CPU E5-2603 v3 @ 1.60GHz

系统类型:64位操作系统,基于X64的处理器 windows10 专业版

第4章 Matlab的符号计算计算的可视化和GUI设计
4.6 句柄图形
4.6.1 句柄图形体系
4.6.2 图形对象的操作
1、图形对象的创建
2、对象句柄的获取

x=0:0.1:2*pi; y=sin(x).*exp(-x); plot(x,y) text(pi,0,'\leftarrowexp(-x)*sin(x)=0') h_fig=gcf h_axes=gca h_obj=gco findobj h_children=get(h_axes,'children') h_parent=get(h_axes,'parent')
h_fig = 1 h_axes = -34.638 h_obj = [](0x0) ans = 0 1.0000 -34.6376 -40.5267 -39.7714 h_children = -40.527 -39.771 h_parent = 1


4.6.3 图形对象的获取和设置

h_fig=figure('color','red','menubar','none','position',[0,0,300,300])

ps.color='red' ps.position=[0,0,300,300] ps.menubar='none' h_fig=figure(ps) p=get(h_fig,'position') c=get(h_fig,'color')
ps = scalar structure containing the fields: color = red ps = scalar structure containing the fields: color = red position = 0 0 300 300 ps = scalar structure containing the fields: color = red position = 0 0 300 300 menubar = none h_fig = 1 p = 0 0 300 300 c = 1 0 0

h_fig=figure('color','red','menubar','none','position',[0,0,300,300]) x=0:0.1:2*pi; y=sin(x).*exp(-x); h_line1=plot(x,y,'b') title('y=sin(x)*exp(-x)') set(gca,'ygrid','on') line1width=get(h_line1,'linewidth')

h_fig=figure('color','red','menubar','none','position',[0,0,300,300]) x=0:0.1:2*pi; y=sin(x).*exp(-x); h_line1=plot(x,y,'b') title('y=sin(x)*exp(-x)') set(gca,'ygrid','on') line1width=get(h_line1,'linewidth') set(h_line1,'linewidth',3)

h_fig=figure('color','red','menubar','none','position',[0,0,300,300]) x=0:0.1:2*pi; y=sin(x).*exp(-x); h_line1=plot(x,y,'b') title('y=sin(x)*exp(-x)') set(gca,'ygrid','on') line1width=get(h_line1,'linewidth') set(h_line1,'linewidth',3) h_title=get(gca,'title') titlefontsize=get(h_title,'fontsize') set(h_title,'fontsize',15)

h_fig=figure('color','red','menubar','none','position',[0,0,300,300]) x=0:0.1:2*pi; y=sin(x).*exp(-x); h_line1=plot(x,y,'b') title('y=sin(x)*exp(-x)') set(gca,'ygrid','on') line1width=get(h_line1,'linewidth') set(h_line1,'linewidth',3) h_title=get(gca,'title') titlefontsize=get(h_title,'fontsize') set(h_title,'fontsize',15) h_text1=text(pi,0,'\downarrow') text1pos=get(h_text1,'position') h_text2=text(text1pos(1,1),text1pos(1,2)+0.025,'exp(-x)*sin(x)=0') set(h_text1,'fontsize',13,'color','red')

h_fig=figure('color','red','menubar','none','position',[0,0,300,300]) x=0:0.1:2*pi; y=sin(x).*exp(-x); h_line1=plot(x,y,'b') title('y=sin(x)*exp(-x)') set(gca,'ygrid','on') line1width=get(h_line1,'linewidth') set(h_line1,'linewidth',3) h_title=get(gca,'title') titlefontsize=get(h_title,'fontsize') set(h_title,'fontsize',15) h_text1=text(pi,0,'\downarrow') text1pos=get(h_text1,'position') h_text2=text(text1pos(1,1),text1pos(1,2)+0.025,'exp(-x)*sin(x)=0') set(h_text1,'fontsize',13,'color','red') set(h_text2,'fontsize',17,'color','green')


4.7 图形用户界面设计
4.7.1 可视化的界面环境
4.7.2 创建菜单

h_fig=gcf h_menu=uimenu(h_fig,'label','Paint')
h_fig = 1 h_menu = -34.638

4.8 动画
4.8.1 以电影方式产生动画

n=20; for i=1:n x=0:0.1:i; y=1-1/sqrt(1-0.3^2)*exp(-0.3*x).*sin(sqrt(1-0.3^2)*x+acos(0.3)); plot(x,y) axis([0,20,0,1.5]) M(i)=getframe; end movie(M,3)


4.8.2 以对象方式产生动画

x=0:0.1:20; y=1-1/sqrt(1-0.3^2)*exp(-0.3*x).*sin(sqrt(1-0.3^2)*x+acos(0.3)); plot(x,y) h=line(0,0,'color','red','marker','.','markersize',40,'erasemode','xor') for i=1:length(x) set(h,'xdata',x(i),'ydata',y(i)); pause(0.005) drawnow end
error: __go_line__: set: unknown line property erasemode, unable to create graphics handle error: called from __line__ at line 161 column 20 line at line 84 column 10 main at line 4 column 2 /opt/run_user_code.m at line 1 column 1
x=0:0.1:20; y=1-1/sqrt(1-0.3^2)*exp(-0.3*x).*sin(sqrt(1-0.3^2)*x+acos(0.3)); plot(x,y) h=line(0,0,'color','red','marker','.','markersize',40) for i=1:length(x) set(h,'xdata',x(i),'ydata',y(i)); pause(0.005) drawnow end

版权声明: 本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若内容造成侵权/违法违规/事实不符,请联系邮箱:809451989@qq.com进行投诉反馈,一经查实,立即删除!
网站建设 2026/6/15 13:23:17

leetcode 775. Global and Local Inversions 全局倒置与局部倒置

Problem: 775. Global and Local Inversions 全局倒置与局部倒置 解题过程 这道题问的是布尔值&#xff0c;也就是global是否>local&#xff0c;不需要统计总数&#xff0c;所以只需要考虑[i, n-1]右侧的最小值是否 < 索引i-2的值即可&#xff0c;因global的值总是>lo…

作者头像 李华
网站建设 2026/6/15 13:25:57

捆绑销售策略制定:购买GPU送一定量token代金券

捆绑销售策略制定&#xff1a;购买GPU送一定量token代金券 在生成式AI加速落地的今天&#xff0c;越来越多个人开发者和中小企业希望拥有一套属于自己的智能知识助手。但现实往往很骨感&#xff1a;大模型部署成本高、技术门槛高、数据安全顾虑多&#xff0c;导致许多团队望而却…

作者头像 李华
网站建设 2026/6/15 13:24:41

揭秘Open-AutoGLM核心技术:如何快速构建高效AI工作流?

第一章&#xff1a;揭秘Open-AutoGLM核心技术&#xff1a;如何快速构建高效AI工作流&#xff1f;Open-AutoGLM 是新一代开源自动化语言模型框架&#xff0c;专为简化复杂AI任务流程而设计。其核心优势在于将模型调用、任务编排与结果解析无缝集成&#xff0c;显著降低开发门槛并…

作者头像 李华
网站建设 2026/6/15 12:54:50

从零搭建开源 APM:SigNoz 本地部署 + cpolar 固定域名远程访问实战

文章目录前言1.关于SigNoz2.本地部署SigNoz3.SigNoz简单使用4. 安装内网穿透5.配置SigNoz公网地址6. 配置固定公网地址前言 SigNoz 是一款集指标、追踪和日志于一体的应用性能性能监控工具&#xff0c;能帮助用户全面掌握分布式系统的运行状态&#xff0c;快速定位性能瓶颈和故…

作者头像 李华
网站建设 2026/6/15 12:52:50

Open-AutoGLM 到底值不值得投入?一文看懂其在生产环境中的真实表现

第一章&#xff1a;Open-AutoGLM 到底值不值得投入&#xff1f;一文看懂其在生产环境中的真实表现在当前大模型技术快速迭代的背景下&#xff0c;Open-AutoGLM 作为一款开源的自动化语言生成框架&#xff0c;凭借其灵活的任务编排能力和对多模态输入的支持&#xff0c;逐渐进入…

作者头像 李华
网站建设 2026/6/15 12:52:18

基于Spring Boot智慧自习室平台系统的设计与实现毕设源码

博主介绍&#xff1a;✌ 专注于Java,python,✌关注✌私信我✌具体的问题&#xff0c;我会尽力帮助你。一、研究目的本研究旨在设计并实现一个基于Spring Boot框架的智慧自习室平台系统。该系统的研发旨在满足现代教育环境中对学生自习空间的高效利用、个性化管理和智能化服务需…

作者头像 李华