Find the points of the curve

2 views (last 30 days)
mohammad
mohammad on 1 Nov 2022
Edited: Voss on 1 Nov 2022
What should be done to convert these 24 points to 48 points so that the output curve is the same
base=[2450,2350,2250,2000,1800,1600,1550,1450,1600,1800,2000,2200,2400,2450,2400,2300,2350,2200 2300 2350 2300 2300 2250 2000]

Accepted Answer

Voss
Voss on 1 Nov 2022
Edited: Voss on 1 Nov 2022
base = [2450,2350,2250,2000,1800,1600,1550,1450,1600,1800,2000,2200,2400,2450,2400,2300,2350,2200 2300 2350 2300 2300 2250 2000];
n = numel(base);
x = 1:n;
plot(x,base,'b.-')
hold on
second_x = linspace(1,n,2*n); % 48 points
second_base = interp1(1:n,base,second_x);
plot(second_x,second_base,'ro')
I think using 47 points makes more sense:
figure()
plot(x,base,'b.-')
hold on
third_x = linspace(1,n,2*n-1); % 47 points
third_base = interp1(1:n,base,third_x);
plot(third_x,third_base,'ro')

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!