Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7584941
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T19:02:54+00:00 2026-05-30T19:02:54+00:00

I’m trying to use a LaTex string to insert a fraction for the y-axis

  • 0

I’m trying to use a LaTex string to insert a fraction for the y-axis label, and I get a number (in standard font and ylabel position) as well as what I expected (the fraction I’m trying to insert). This has changed for me when I’ve edited the code, but stopped once I tried investigating this (it’s 353.191 as I type, in case it helps). The number is not there if I don’t try to add a label to the y-axis, or add a label without LaTex. There is no error message.

Code in question:

ylabel(text('Interpreter','LaTex',...
    'string','$\frac{\tau_b(t)}{\phi \bar{U}}$',...
    'FontSize',20,'position',[-1.25,0.2]));

Full Program (above code is just before program finishes):

% --- MM3CAI Coursework 1 ---

clear all; clf('reset'); clc;

fig_num=0;

disp('Started program');
disp(' ');

% --- Task 1. About the water-brake only ---

disp('Started task 1');
disp(' ');

w_t=0.003;          % Volume of water in the brake at time t        [m^3]
thet_t=250;         % Angular velocity of brake at time t           [rads^-1]

percent=0.1;        % Percent added to values for small change      [%]
fraction=percent/100;

del_w=w_t*fraction;
del_t=thet_t*fraction;

w_del=w_t+del_w;
thet_del=thet_t+del_t;

clear percent fraction;

% --- Q1 ---

disp('Started question 1');
disp(' ');

tau  =150*w_t  *thet_t;
tau_w=150*w_del*thet_t;
tau_t=150*w_t  *thet_del;

tau_mat=[tau;...
     tau_w;...
     tau_t];

A=[w_t   thet_t   1;...
w_del thet_t   1;...
w_t   thet_del 1];

variables_mat=A\tau_mat;

phi=variables_mat(1,1);
psi=variables_mat(2,1);
eta=variables_mat(3,1);

disp(['Phi = ', num2str(phi)]);
disp(['Psi = ', num2str(psi)]);
disp(['Eta = ', num2str(eta)]);
disp(' ');

disp('Finished question 1');
disp('----------');

% --- Q2 ---

disp('Started question 2');
disp(' ');

beta=-eta/phi;

disp(['Beta = ', num2str(beta)]);
disp(' ');

disp('Finished question 2');
disp('----------');

% --- Q4 ---

disp('Started question 4');
disp(' ');

G=@(omega) phi./(1+(5i.*omega));

frequency=logspace(-3,3,700)';

G_mat=G(frequency);

phase_mat_rad=angle(G_mat);
phase_mat_deg=phase_mat_rad.*(180/pi);

magnitude_mat=abs(G_mat);
gain_mat=20.*log10(magnitude_mat);

fig_num=fig_num+1;
figure(fig_num);
subplot(2,1,1);
semilogx(frequency,gain_mat);
title('Bode Plot');
xlabel('Frequency [rads^-^1]');
ylabel('Gain [dBs]');
subplot(2,1,2);
semilogx(frequency,phase_mat_deg);
xlabel('Frequency [rads^-^1]');
ylabel('Phase Angle [degrees]');

disp('Finished question 4');
disp('----------');

% --- Q5 ---

disp('Started question 5');
disp(' ');

U_bar=1;
step=@(t) (phi*U_bar)*(1-exp(-t/5));

time=(0:0.01:8);

step_mat=step(time);
normalised=step_mat./(phi*U_bar);

fig_num=fig_num+1;
figure(fig_num);
plot(time,normalised);
title('Step Response');
xlabel('Time [s]');
ylabel(text('Interpreter','LaTex',...
        'string','$\frac{\tau_b(t)}{\phi \bar{U}}$',...
        'FontSize',20,'position',[-1.25,0.2]));

disp('Finished question 5');
disp('----------');

I’m really confused by this, which makes it harder to find anything. All I could find was basic MatLab help about using LaTex (which is how I muddled the string together) and people having issues where text() wasn’t working and generating an error – nothing where the expected output was generated and something else appeared.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T19:02:56+00:00Added an answer on May 30, 2026 at 7:02 pm

    TEXT function returns the handle to text object, which is actually a number. This is the number you get as y-label. You only need to pass the string as the first argument to YLABEL and specify the Interpreter (and FontSize) property:

    ylabel('$\frac{\tau_b(t)}{\phi \bar{U}}$','Interpreter','LaTex','FontSize',20);
    

    Position is determined automatically by ylabel.

    In your ylabel statement the text object is actually created (this is why you don’t get an error), but the position chosen in such a way that the text is outside of the visible area. -1.25 means the text is located 1.25 of the axes size to the left.

    You can also use text object along as axes label, but you will have to adjust the text position with axes size change.

    text('Interpreter','LaTex',...
        'string','$\frac{\tau_b(t)}{\phi \bar{U}}$',...
        'FontSize',20,'position',[-0.1,0.5]);
    

    Notice, Position property is not x and y, but axes fractions.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
I am trying to understand how to use SyndicationItem to display feed which is
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
Basically, what I'm trying to create is a page of div tags, each has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I would like to count the length of a string with PHP. The string
For some reason, after submitting a string like this Jack’s Spindle from a text
I've got a string that has curly quotes in it. I'd like to replace
Specifically, suppose I start with the string string =hello \'i am \' me And

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.