1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > 利用Matlab编程画图的常用代码(更新中)

利用Matlab编程画图的常用代码(更新中)

时间:2020-07-29 13:21:25

相关推荐

利用Matlab编程画图的常用代码(更新中)

将MATLAB的画图参数重置

有时候我们不小心将MATLAB的画图设置全局之后,比如

set(0,'defaultFigureUnits','centimeters');set(0,'defaultFigurePosition',[0 0 width hight]);set(0,'defaultLineLineWidth',1*k_scaling);set(0,'defaultAxesLineWidth',0.25*k_scaling);set(0,'defaultAxesGridLineStyle',':');set(0,'defaultAxesYGrid','on');set(0,'defaultAxesXGrid','on');set(0,'defaultAxesFontName','Times New Roman');set(0,'defaultAxesFontSize',8*k_scaling);set(0,'defaultTextFontName','Times New Roman');set(0,'defaultTextFontSize',8*k_scaling);set(0,'defaultLegendFontName','Times New Roman');set(0,'defaultLegendFontSize',8*k_scaling);set(0,'defaultAxesUnits','normalized');set(0,'defaultAxesPosition',[left/width bottom/hight (width-left-right)/width (hight-bottom-top)/hight]);set(0,'defaultAxesColorOrder',[0 0 0]);set(0,'defaultAxesTickDir','out');set(0,'defaultFigurePaperPositionMode','auto');

但是修改之后,恢复到原来很麻烦

这时候用这个代码一键还原到原始的设置

reset(groot);%重新将设置格式化

画子图

figure;subplot(3,1,1);plot(pluseWave_ICA(1,:),'LineWidth',2,'color','red');title('pluseWave ICA 1');subplot(3,1,2);plot(pluseWave_ICA(2,:),'LineWidth',2,'color','green');title('pluseWave ICA 2');subplot(3,1,3);plot(pluseWave_ICA(3,:),'LineWidth',2,'color','blue');title('pluseWave ICA 3');

画伯德图

P=bodeoptions;P.FreqUnits='Hz';%单位改成HzP.FreqScale='log';%set logP.MagUnits='dB';P.XLim={[1 100000]};bode(Go,Gi,open_sys1,P);grid on;

设置图例

legend('Without compenstion','PI controller','With compenstion');

设置Figure中的线宽

h = findobj(gcf, 'Type','line');%设置线的粗细set(h, 'LineWidth', 1.5);

alpha-beta to dq变换的公式

%% Matlab dq模块变换方式的公式对应%% 变换的第一种形式:A相与d轴重合%对应Matlab模块的第一种Aligned with A phaseu_alpha=vg_alpha;u_beta=vg_beta;% 正变换ud=u_alpha*cos(wt)+u_beta*sin(wt);uq=u_alpha*(-sin(wt))+u_beta*cos(wt);vg_d=ud;vg_q=uq;%对应的逆变换% u_alpha=cos(wt)*ud-sin(wt)*uq;% u_beta=sin(wt)*ud+cos(wt)*uq;%% 变换的第二种形式:d轴滞后A相90°%对应Matlab模块的第二种90 degree behind phase A%正变换% ud=sin(wt)*u_alpha-cos(wt)*u_beta;% uq=cos(wt)*u_alpha+sin(wt)*u_beta;%逆变换%u_alpha=sin(wt)*ud+cos(wt)*uq;%u_beta=-cos(wt)*ud+sin(wt)*uq;

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。