Matlab plot label's text is unreadable -
first of all, i'm newbie matlab. use because need control system toolboox university.
yesterday, launched script:
% % esempio 11.2 % clear close clc % numg=10; deng=conv([10 1],[5 1]);deng=conv(deng,[1 1]); g=tf(numg,deng); % numra=8*deng; denra=conv([250 1],[0.4 1]);denra=conv(denra,[0.4 1]); ra=tf(numra,denra); numrb=8*conv([10 1],[5 1]); denrb=conv([250 1],[0.4 1]); rb=tf(numrb,denrb); numrc=8*conv([5 1],[1 1]); denrc=conv([0.02 1],[0.02 1]); rc=tf(numrc,denrc); numrd=0.025*conv([10 1],[5 1]); denrd=[1 1 0]; rd=tf(numrd,denrd); % la=g*ra; lb=g*rb; lc=g*rc; ld=g*rd; % calcolo margini di guadagno e di fase [kma,pma,wpa,wca]=margin(la); [kmb,pmb,wpb,wcb]=margin(lb); [kmc,pmc,wpc,wcc]=margin(lc); [kmd,pmd,wpd,wcd]=margin(ld); % calcolo massimo ritardo tollerabile taua=(pma/wca)*pi/180; taub=(pmb/wcb)*pi/180; tauc=(pmc/wcc)*pi/180; taud=(pmd/wcd)*pi/180; % fa=la/(1+la); fb=lb/(1+lb); fc=lc/(1+lc); fd=ld/(1+ld); % qa=ra/(1+la); qb=rb/(1+lb); qc=rc/(1+lc); qd=rd/(1+ld); % % figura 11.4 w=logspace(-2,2,1000); [ml1,pl1]=bode(8*g,w); ml1=20*log10(ml1); ml1=squeeze(ml1)'; pl1=squeeze(pl1)'; subplot(211),semilogx(w,ml1),grid xlabel('\omega'),ylabel('db') subplot(212),semilogx(w,pl1),grid xlabel('\omega'),ylabel('gradi') % figura 11.6 w=logspace(-2,2,1000); [mlc,plc]=bode(lc,w); mlc=20*log10(mlc); mlc=squeeze(mlc)'; plc=squeeze(plc)'; figure subplot(211),semilogx(w,mlc),grid xlabel('\omega'),ylabel('db') subplot(212),semilogx(w,plc),grid xlabel('\omega'),ylabel('gradi') % figura 11.8 w=logspace(-2,2,1000); [mra,pra]=bode(ra,w); mra=20*log10(mra);mra=squeeze(mra)';pra=squeeze(pra)'; [mrb,prb]=bode(rb,w); mrb=20*log10(mrb);mrb=squeeze(mrb)';prb=squeeze(prb)'; [mrc,prc]=bode(rc,w); mrc=20*log10(mrc);mrc=squeeze(mrc)';prc=squeeze(prc)'; [mrd,prd]=bode(rd,w); mrd=20*log10(mrd);mrd=squeeze(mrd)';prd=squeeze(prd)'; figure subplot(211),semilogx(w,mra,w,mrb,w,mrc,w,mrd),grid xlabel('\omega'),ylabel('db') legend('a','b','c','d') subplot(212),semilogx(w,pra,w,prb,w,prc,w,prd),grid xlabel('\omega'),ylabel('gradi') legend('a','b','c','d') % figura 11.9 t=0:0.01:25; ya=step(fa,t); yb=step(fb,t); yc=step(fc,t); yd=step(fd,t); figure plot(t,ya,t,yb,t,yc,t,yd),grid xlabel('t'),ylabel('y') legend('a','b','c','d') % figura 11.10 t=0:0.01:5; ua=step(qa,t); ub=step(qb,t); uc=step(qc,t)/1e4; ud=step(qd,t); figure plot(t,ua,t,ub,t,uc,t,ud),grid xlabel('t'),ylabel('u') legend('a','b','c (x10^4)','d') % figura 11.11 gp=g*tf(4,[1 0.4 4]); fpa=ra*gp/(1+ra*gp); fpb=rb*gp/(1+rb*gp); fpc=rc*gp/(1+rc*gp); fpd=rd*gp/(1+rd*gp); t=0:0.01:25; ya=step(fpa,t); yb=step(fpb,t); yc=step(fpc,t); yd=step(fpd,t); figure plot(t,ya,t,yb,t,yc,t,yd),grid xlabel('t'),ylabel('y') axis([0 25 0 1.2]) legend('a','b','c','d') % figura 11.12 t=0:0.01:25; yrif=ones(size(t)); n=sin(2*t); ya=lsim(fa,yrif-n,t); yb=lsim(fb,yrif-n,t); yc=lsim(fc,yrif-n,t); yd=lsim(fd,yrif-n,t); figure plot(t,ya,t,yb,t,yc,t,yd),grid xlabel('t'),ylabel('y') legend('a','b','c','d')
now, each time plot 'bode' function or 'nyquist' function, or 'plot' function, appears this:
what can solve problem? thank you!
your code works fine , renders on machine. looks problem graphics driver or hardware. here 2 possible solutions:
update drivers
update graphics driver latest version. might solve problem already.
opengl
on windows , linux can use opengl instead of systems hardware render graphics. therefore can execute following command, matlab opens in opengl-mode in future:
opengl('save','software')
if want start matlab using systems hardware, use following command change back:
opengl('save','hardware')
in case want start matlab in opengl-mode once, can open matlab in command prompt of operation system -softwareopengl
argument:
matlab -softwareopengl
Comments
Post a Comment