How do I write an x with a dot over it on my graph legend?

99 views (last 30 days)
I have a simple problem. I want to use dot notation . like v =dx/dt but I use a dot notation so velocity will be an x with a dot over it like a hat. how do I accomplish that? I know there are certain markups I can use in the legend function likelegend('\delta x(t)) = Δx(t).
What code do I use to get this: ẋ ??
Please and thank you.

Answers (1)

Abhas
Abhas on 5 Jul 2023
Hi Nasir,
You can set the dot over a variable on your graph as a legend using the following method:-
t = [0, 1, 2, 3, 4]; % Time values
x = [0, 2, 4, 6, 8]; % Position values
% Plot the data
plot(t, x)
% Set the labels
xlabel('Time')
ylabel('Position')
% Set the legend with dot notation
legend('$\dot{x}(t)$ = Velocity', 'Interpreter', 'latex')
Hope this helps!

Categories

Find more on 2-D and 3-D Plots in Help Center and File Exchange

Products


Release

R2023a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!