Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- clear all;
- % Pidgeon locations in pixels
- x = [39, 48, 60, 77, 93, 116, 140, 172, 209, 256, 312, 418, 629].'
- n = size(x)
- % Fibonacci, variable a is for shifting all the locations
- cvx_begin
- variables x_fib(n) a
- minimize norm(x_fib - (x - a))
- subject to
- x_fib(1:n-2) + x_fib(2:n-1) == x_fib(3:n)
- 2 * x_fib(1) == x_fib(2)
- cvx_end
- % Quadratic
- p = polyfit([1:n].', x, 2)
- p_objective = norm(polyval(p, [1:n].') - x)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement