网页资讯视频图片知道文库贴吧地图采购
进入贴吧全吧搜索

 
 
 
日一二三四五六
       
       
       
       
       
       

签到排名:今日本吧第个签到,

本吧因你更精彩,明天继续来努力!

本吧签到人数:0

一键签到
成为超级会员,使用一键签到
一键签到
本月漏签0次!
0
成为超级会员,赠送8张补签卡
如何使用?
点击日历上漏签日期,即可进行补签。
连续签到:天  累计签到:天
0
超级会员单次开通12个月以上,赠送连续签到卡3张
使用连续签到卡
08月02日漏签0天
matlab吧 关注:291,870贴子:1,658,310
  • 看贴

  • 图片

  • 吧主推荐

  • 游戏

  • 1回复贴,共1页
<<返回matlab吧
>0< 加载中...

高手帮我看下这个程序

  • 只看楼主
  • 收藏

  • 回复
  • 战定不退乄
  • 初涉江湖
    1
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
close all;clear;clc;
figure('position',[189 89 714 485]);
Na=['输入波形[请选择]|输入波形:正弦波|',...
      ];
Ns={'sin','square','pulse'};

R=2;  % default parameters: resistance
C=2;  % default parameters: capacitance
f=10; % default parameters: frequency

TAU=R*C;;
tff=10;  % length of time
ts=1/f;  % sampling length

sys1=tf([1],[1,1]);     % systems for integral circuit
sys2=tf([1,0],[1,1]);   % systems for differential circuit

a1=axes('position',[0.1,0.6,0.3,0.3]);
po1=uicontrol(gcf,'style','popupmenu',...
    'unit','normalized','position',[0.15,0.9,0.2,0.08],...
    'string',Na,'fontsize',12,'callback',[]);
set(po1,'callback',['KK=get(po1,''Value'');if KK>1;',...
        'st=char(Ns(KK-1));[U,T]=gensig(st,R*C,tff,1/f);',...
        'axes(a1);plot(T,U);ylim([min(U)-0.5,max(U)+0.5]);',...
        'end;']);
Ma=['电路类型[请选择]|电路类型:积分型'];
a2=axes('position',[0.5,0.6,0.3,0.3]);box on;
set(gca,'xtick',[]);set(gca,'ytick',[]);
po2=uicontrol(gcf,'style','popupmenu',...
    'unit','normalized','position',[0.55,0.9,0.2,0.08],...
    'string',Ma,'fontsize',12,'callback',[]);
set(po2,'callback',['KQ=get(po2,''Value'');axes(a2);',...
        'if KQ==1;cla;elseif KQ==2;',...
        'plot(0.14+0.8i+0.02*exp(i*[0:.02:8]),''k'');hold on;',...
        'plot(0.14+0.2i+0.02*exp(i*[0:.02:8]),''k'');',...
        'plot(0.84+0.2i+0.02*exp(i*[0:.02:8]),''k'');',...
        'plot(0.84+0.8i+0.02*exp(i*[0:.02:8]),''k'');',...
        'plot([0.16,0.82],[0.2,0.2],''k'');',...
        'plot([0.16,0.3],[0.8,0.8],''k'');',...
        'plot([3,4,4,3,3]/10,[76,76,84,84,76]/100,''k'');',...
        'plot([0.4,0.82],[0.8,0.8],''k'');',...
        'plot([0.6,0.6],[0.8,0.53],''k'');',...
        'plot([0.6,0.6],[0.2,0.48],''k'');',...
        'plot([0.55,0.65],[0.53,0.53],''k'');',...
        'plot([0.55,0.65],[0.48,0.48],''k'');',...
        'text(0.33,0.7,''R'');',...
        'text(0.63,0.42,''C'');',...
        'text(0.8,0.5,''U_o'');text(0.1,0.5,''U_i'');hold off;',...
        'set(gca,''xtick'',[]);set(gca,''ytick'',[]);',...
        'else;',...
        'plot(0.14+0.8i+0.02*exp(i*[0:.02:8]),''k'');hold on;',...
        'plot(0.14+0.2i+0.02*exp(i*[0:.02:8]),''k'');',...
        'plot(0.84+0.2i+0.02*exp(i*[0:.02:8]),''k'');',...
        'plot(0.84+0.8i+0.02*exp(i*[0:.02:8]),''k'');',...
        'plot([0.16,0.82],[0.2,0.2],''k'');',...
        'plot([0.16,0.33],[0.8,0.8],''k'');',...
        'plot([0.33,0.33],[0.74,0.86],''k'');',...
        'plot([0.36,0.36],[0.74,0.86],''k'');',...
        'plot([0.36,0.82],[0.8,0.8],''k'');',...
        'plot([0.6,0.6],[0.8,0.58],''k'');',...
        'plot([0.6,0.6],[0.2,0.42],''k'');',...
        'plot([58,62,62,58,58]/100,[42,42,58,58,42]/100,''k'');',...
        'text(0.33,0.68,''C'');',...
        'text(0.63,0.42,''R'');',...
        'text(0.8,0.5,''U_o'');text(0.1,0.5,''U_i'');hold off;',... 
        'set(gca,''xtick'',[]);set(gca,''ytick'',[]);',...
        'end;axis([0,1,0,1]);']);

a3=axes('position',[0.1,0.1,0.3,0.3]);
pu3=uicontrol(gcf,'style','push',...



  • 战定不退乄
  • 初涉江湖
    1
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼
    'unit','normalized','position',[0.15,0.43,0.2,0.04],...
    'string','显示输出波形','fontsize',12,...
    'callback',['axes(a3);if KQ==2;lsim(sys1,U,T);',...
        'elseif KQ==3;lsim(sys2,U,T);else,cla;end;']);

uicontrol(gcf,'style','frame',...
    'unit','normalized','position',[0.47,0.13,0.5,0.32],...
    'string','10','BackgroundColor',[0.8,0.8,0.8],...
    'fontsize',16,'fontname','times new roman');

s1=uicontrol(gcf,'style','slider',...
    'unit','normalized','position',[0.55,0.38,0.3,0.03],...
    'Value',0.5,'SliderStep',[0.01 0.01],...
    'callback',['R=1+get(s1,''Value'')*2;',...
        '[U,T]=gensig(st,R*C,tff,1/f);',...
        'set(t1,''string'',num2str(R));']);

uicontrol(gcf,'style','text',...
    'unit','normalized','position',[0.5,0.37,0.05,0.05],...
    'string','R','BackgroundColor',[0.8,0.8,0.8],...
    'fontsize',16,'fontname','times new roman');
t1=uicontrol(gcf,'style','text',...
    'unit','normalized','position',[0.86,0.37,0.1,0.05],...
    'string','2','BackgroundColor',[0.8,0.8,0.8],...
    'fontsize',16,'fontname','times new roman');

s2=uicontrol(gcf,'style','slider',...
    'unit','normalized','position',[0.55,0.28,0.3,0.03],...
    'Value',0.5,'SliderStep',[0.01 0.01],...
    'callback',['C=1+get(s2,''Value'')*2;',...
        '[U,T]=gensig(st,R*C,tff,1/f);',...
        'set(t2,''string'',num2str(C));']);
uicontrol(gcf,'style','text',...
    'unit','normalized','position',[0.5,0.27,0.05,0.05],...
    'string','C','BackgroundColor',[0.8,0.8,0.8],...
    'fontsize',16,'fontname','times new roman');
t2=uicontrol(gcf,'style','text',...
    'unit','normalized','position',[0.86,0.27,0.1,0.05],...
    'string','2','BackgroundColor',[0.8,0.8,0.8],...
    'fontsize',16,'fontname','times new roman');
set(gcf,'NumberTitle','off','MenuBar','none');
set(gcf,'name','基于matlab的电路仿真');
uu=uimenu(gcf,'label','About');
uimenu(uu,'label','Author:Zjliu');
ku=uimenu(gcf,'label','Readme');
kw1=uimenu(gcf,'label','执行顺序:');
kw2=uimenu(gcf,'label','设定参数-->确定波形-->选择电路类型-->输出波形');
set(kw1,'ForegroundColor','r');set(kw2,'ForegroundColor','b');
uicontrol(gcf,'style','text',...
    'unit','normalized','position',[0.5,0.47,0.46,0.05],...
    'string','请选择波形之前改变下面的参数',...
    'BackgroundColor',[0.8,0.8,0.8],...
    'fontsize',16,'fontname','times new roman');    % readme

s3=uicontrol(gcf,'style','slider',...
    'unit','normalized','position',[0.55,0.18,0.3,0.03],...
    'Value',0.5,'SliderStep',[0.01 0.01],...
    'callback',['f=5+get(s3,''Value'')*10;',...
        '[U,T]=gensig(st,R*C,tff,1/f);',...
        'set(t3,''string'',num2str(f));']);
uicontrol(gcf,'style','text',...
    'unit','normalized','position',[0.5,0.17,0.05,0.05],...
    'string','f','BackgroundColor',[0.8,0.8,0.8],...
    'fontsize',16,'fontname','times new roman');
t3=uicontrol(gcf,'style','text',...
    'unit','normalized','position',[0.86,0.17,0.1,0.05],...
    'string','10','BackgroundColor',[0.8,0.8,0.8],...
    'fontsize',16,'fontname','times new roman');
能帮我简单的分析下上面的程序吗?
比如使用的函数这些


登录百度账号

扫二维码下载贴吧客户端

下载贴吧APP
看高清直播、视频!
  • 贴吧页面意见反馈
  • 违规贴吧举报反馈通道
  • 贴吧违规信息处理公示
  • 1回复贴,共1页
<<返回matlab吧
分享到:
©2025 Baidu贴吧协议|隐私政策|吧主制度|意见反馈|网络谣言警示