news 2026/1/27 6:00:06

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/1/27 5:23:16

Open-AutoGLM浏览器集成故障排查全指南(90%用户忽略的底层机制)

第一章:Open-AutoGLM无法调用浏览器当使用 Open-AutoGLM 框架进行自动化任务时,部分用户反馈系统无法正常调用本地浏览器执行操作。该问题通常与环境配置、驱动兼容性或权限设置有关,需逐一排查。检查浏览器驱动配置 Open-AutoGLM 依赖于 Sel…

作者头像 李华
网站建设 2026/1/24 22:30:56

揭秘智谱Open-AutoGLM部署难题:5大常见错误及高效解决方案

第一章:智谱Open-AutoGLM部署概述智谱AI推出的Open-AutoGLM是一个面向自动化自然语言处理任务的开源大模型框架,支持文本生成、意图识别、自动摘要等多种功能。该框架基于GLM架构优化,在保持高性能的同时降低了部署门槛,适用于企业…

作者头像 李华
网站建设 2026/1/14 3:36:01

【Open-AutoGLM爆火前夜】:它能否复制ChatGPT的奇迹?

第一章:Open-AutoGLM会和chatgpt一样火吗Open-AutoGLM作为新一代开源自动代码生成语言模型,正引发开发者社区的广泛关注。其设计理念聚焦于降低AI编程门槛,同时提升本地化部署与数据隐私保障能力,这在企业级应用场景中具备显著优势…

作者头像 李华
网站建设 2026/1/25 17:37:39

一文掌握AI Agent系统:六大核心模块构建智能闭环,建议收藏

文章详细解析了AI Agent系统的六大核心模块:感知模块、决策规划模块、执行模块、专业大模型模块、记忆管理和反馈系统。这些模块协同工作形成智能闭环,使AI Agent能够感知环境、自主决策、执行任务并持续进化。文章以金融数据分析智能体为例,…

作者头像 李华