A "plot" progression of points following a round course

1 view (last 30 days)
Hi there,
Basically, I have these points on a plot but the thing is that I need to have the progression's shape to be round and not looking like a conglomerate of connected lines. I need something like in this picture from excel:
My actual plot looks like this at the moment:
Here's the code that I used, the values in the vectors mustn't be modified.
beta=[0 0.2 0.4 0.6 0.8 1 1.2];
randr=[0 84.25 89.97 91.38 91.60 91.32 90.81];
randrl=[0 79.08 86.38 88.23 88.51 88.15 87.48];
randrc=[0 76.24 84.33 86.41 86.74 86.33 85.57];
plot(beta,randr,'-d');
hold on;
plot(beta,randrl,'-d');
plot(beta,randrc,'-d');
xlabel('β');
ylabel('U2[V]');
grid on;
ylim([0 100]);

Accepted Answer

Bora Eryilmaz
Bora Eryilmaz on 12 Dec 2022
Edited: Bora Eryilmaz on 12 Dec 2022
You can use a (cubic) spline for interpolation.
beta=[0 0.2 0.4 0.6 0.8 1 1.2];
randr=[0 84.25 89.97 91.38 91.60 91.32 90.81];
randrl=[0 79.08 86.38 88.23 88.51 88.15 87.48];
randrc=[0 76.24 84.33 86.41 86.74 86.33 85.57];
% Use cubic spline for interpolation
x = linspace(min(beta), max(beta), 100); % Create a finer grid of x-axis values.
r = spline(beta, randr, x); % Interpolate on the finer grid.
rl = spline(beta, randrl, x);
rc = spline(beta, randrc, x);
plot(x,r,'-');
hold on;
plot(x,rl,'-');
plot(x,rc,'-');
plot(beta,randr,'d');
plot(beta,randrl,'d');
plot(beta,randrc,'d');
xlabel('β');
ylabel('U2[V]');
grid on;
ylim([0 100]);

More Answers (0)

Categories

Find more on Spline Postprocessing in Help Center and File Exchange

Products


Release

R2022b

Community Treasure Hunt

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

Start Hunting!