Sequence 1, 2, 4, 12
11 次查看(过去 30 天)
显示 更早的评论
Hi everyone!
I need to know the rule for generating the following sequence: 1, 2, 4, 12 (that's all, no more values in the sequence). Does anyone have an idea for the rule to go forward (1-->2-->4-->12) and backward (12-->4-->2-->1)?
Any help is really apreciated! Thanks in advance.
0 个评论
回答(2 个)
Hernia Baby
2021-9-18
You can use polyfit and polyval.
Here is one of examples.
n = 6;
x = 1:4;
y = [1,2,4,12];
p = polyfit(x,y,n)
x1 = linspace(0,4,100);
y1 = polyval(p,x1);
figure
plot(x,y,'o')
hold on
plot(x1,y1)
hold off
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!