Best way to relabel axis as pi for trig functions.
Hi all, I was looking for ways to relabel my x-axis as pi increments for trig functions and was wondering which one would be most effective.
This is what chatgpt gave, but I wanted to see if there are any better ways to achieve the same result. TIA!!
clc, clearvars
x = linspace(0,2*pi,200);
y = sin(x);
% Plot
figure
hold on
plot(x, y)
% Pi Labeling
xt = 0:pi/2:2*pi;
xticks(xt)
label = compose(‘%g\pi’, xt/pi);
xticklabels(label)Hi all, I was looking for ways to relabel my x-axis as pi increments for trig functions and was wondering which one would be most effective.
This is what chatgpt gave, but I wanted to see if there are any better ways to achieve the same result. TIA!!
clc, clearvars
x = linspace(0,2*pi,200);
y = sin(x);
% Plot
figure
hold on
plot(x, y)
% Pi Labeling
xt = 0:pi/2:2*pi;
xticks(xt)
label = compose(‘%g\pi’, xt/pi);
xticklabels(label) Hi all, I was looking for ways to relabel my x-axis as pi increments for trig functions and was wondering which one would be most effective.
This is what chatgpt gave, but I wanted to see if there are any better ways to achieve the same result. TIA!!
clc, clearvars
x = linspace(0,2*pi,200);
y = sin(x);
% Plot
figure
hold on
plot(x, y)
% Pi Labeling
xt = 0:pi/2:2*pi;
xticks(xt)
label = compose(‘%g\pi’, xt/pi);
xticklabels(label) xtick, label, trigonometry, pi MATLAB Answers — New Questions









