Help please, I want to avoid a warning message.
이전 댓글 표시
The following Matlab script produce a correct result but with a long warning red text:
-----------------------------------------
% Problem_B_7_3_Modern_Control_Engineering_Katsuhiko_Ogata
clear all
clc
fprintf(' \n')
fprintf('--------------------- \n')
fprintf('Transfer functions \n')
nG1=[1,1]; dG1=[2,1];
G1=tf(nG1,dG1)
nG2=[-1,1]; dG2=[2,1];
G2=tf(nG2,dG2)
fprintf('--------------------- \n')
fprintf('Figure 1 : Body Diagrams \n')
figure(1)
subplot(1,2,1)
bode(G1)
grid on
% From here the problem start
syms s
G1_sym = poly2sym(nG1,s)/poly2sym(dG1,s);
G1_latex = latex(G1_sym);
str1=['$ \it {G1(s)=',char(G1_latex),' } \quad $'];
title(str1,'Interpreter','latex','Fontsize',14)
subplot(1,2,2)
bode(G2)
grid on
G2_sym = poly2sym(nG2,s)/poly2sym(dG2,s);
G2_latex = latex(G2_sym);
str2=['$ \it {G2(s)=',char(G2_latex),' } \quad $'];
title(str2,'Interpreter','latex','Fontsize',14)
fprintf('--------------------- \n')
--------------------------------------------
How can I avoid the warning message, please.
댓글 수: 2
What error does it throw?
It runs without error in R2022a —
fprintf(' \n')
fprintf('--------------------- \n')
fprintf('Transfer functions \n')
nG1=[1,1]; dG1=[2,1];
G1=tf(nG1,dG1)
nG2=[-1,1]; dG2=[2,1];
G2=tf(nG2,dG2)
fprintf('--------------------- \n')
fprintf('Figure 1 : Body Diagrams \n')
figure(1)
subplot(1,2,1)
bode(G1)
grid on
% From here the problem start
syms s
G1_sym = poly2sym(nG1,s)/poly2sym(dG1,s);
G1_latex = latex(G1_sym);
str1=['$ \it {G1(s)=',char(G1_latex),' } \quad $'];
title(str1,'Interpreter','latex','Fontsize',14)
subplot(1,2,2)
bode(G2)
grid on
G2_sym = poly2sym(nG2,s)/poly2sym(dG2,s);
G2_latex = latex(G2_sym);
str2=['$ \it {G2(s)=',char(G2_latex),' } \quad $'];
title(str2,'Interpreter','latex','Fontsize',14)
fprintf('--------------------- \n')
% --------------------------------------------
.
This:
text(0.2, 0.5, ['$ \it {G1(s)=\frac{\frac{s}{2} + \frac{1}{2}}{s + \frac{1}{2}} } \quad $'], 'Interpreter','latex', 'FontSize',30)
runs without error in R2022a.
I no longer have access to R2015a, so I cannot determine what the problem is with that version.
Be sure you have all the available R2015a updates.
채택된 답변
추가 답변 (2개)
Walter Roberson
2022년 5월 16일
0 개 추천
Upgrade your release. That title is fine in current releases.
Question: why are you using \quad there? Why add space at the end of the title?
카테고리
도움말 센터 및 File Exchange에서 Scripts에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

