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

18 次查看(过去 30 天)
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.

回答(1 个)

Abhas
Abhas 2023-7-5
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!

类别

Help CenterFile Exchange 中查找有关 Legend 的更多信息

产品


版本

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by