Asked by Anant
on 30 Jun 2012

Hi,

I am making a graph and the below command is not writing a fraction, when the frac is used:

title('Q \geq frac{I_h H}{I_h H+I_z C}, b_1 \geq b_2');

The entire code is :

set(0,'DefaultAxesFontSize',10)

time=140;

Ct0=0.86; % Initial efficacy of Deltamethrin

N1= 810;

Ih= 0.4;

Iz= 2;

b1=-0.026; % indoor decay rate of insecticide

b2=-0.026; % outdoor decay rate of insecticide

Q= 0.2554;

H= 9.23675;

C= 5.39289;

for t=1:time

BCRh(t+1)= [(Q*Ct0)/(N1*Ih*1000000*H)] * exp(b1*t);

BCRz(t+1) = [((1-Q)*Ct0)/(N1*Iz*1000000*C)] * exp(b2*t);

end

figure('Color',[1 1 1]);

figure(1)

plot([0:1:time],BCRh,'g-', [0:1:time],BCRz,'k:','LineWidth',2);

xlabel('\tau');

title('Q \geq frac{I_h H}{I_h H+I_z C}, b_1 \geq b_2');

legend('BCR_h(\tau) ','BCR_z(\tau)');

clear all

Can someone please help me, on how to print a fraction in the title. Have I not used the correct latex syntax?

Thanks,

KKG.

Answer by Wayne King
on 30 Jun 2012

Accepted Answer

Hi, You should use the LaTex interpreter.

figure;

title('$$Q \geq \frac{I_h H}{I_h H+I_z C}, b_1 \geq b_2$$','interpreter','latex')

Sign in to comment.

Opportunities for recent engineering grads.

Apply Today
## 2 Comments

## hamed shorakaei (view profile)

Direct link to this comment:https://ch.mathworks.com/matlabcentral/answers/42448-about-latex-command-in-the-title#comment_490726

## Walter Roberson (view profile)

Direct link to this comment:https://ch.mathworks.com/matlabcentral/answers/42448-about-latex-command-in-the-title#comment_490728

Sign in to comment.