Can I use matlab to curve fit/predict market price of a company? I

Ok, So I want to model the closing price of Apple (for educational purpose) and I am looking for mathematical tools that would make it easier. I have used excel to get a trend line of 6th degree polynomial. <https://docs.google.com/file/d/0Bz9r9M4ruXtrWjMwUmRtNTVfbGc/edit?usp=sharing>
I want my input to have the data integrated from 1990 to 2010 and with that, i want the my estimation function to be able to approximate closing price of 10 years.
I know i have to use probability and statistics theories but i wanted some specific answers about what theory I must use.
I would be glad if you could guide me to the tools that can be used in matlab for the job and also, tutorials too :D
Thanks

1 Comment

i looked into this webinar https://www.mathworks.in/webex/recordings/NA_110324_fittingml/index.html
but it was not much of help. Too technical.

Sign in to comment.

Answers (2)

Do you have the curve fitting toolbox? If so, either click on the curve fitting app in the apps gallery or run:
>> cftool
This will pull up an interactive environment for you to do your curve fitting.
As an aside, I highly recommend against fitting high order polynomials to anything. They're highly unstable, overfit to noise, are useless for prediction and have no place in physics. If you are trying to fit to something that does not have an analytic model, such as a stock price, use one of the data driven modeling techniques. This webinar might interest you:

2 Comments

I've heard if you use a n+1 degree polynomial to perfectly fit any n-points :-). Complex coefficients in question in the most general case.

Sign in to comment.

Try this untested code:
[coeffs, s, mu] = polyfit(dates, prices, 6);
extrapolatedPrices = polyval(coeffs, extrapolatedDates, s, mu);
plot(extrapolatedDates, extrapolatedPrices, 'b-', 'LineWidth', 3);
grid on;
fontSize = 24;
title('Apple Stock', 'FontSize', fontSize);
xlabel('Date', 'FontSize', fontSize);
ylabel('Stock Price', 'FontSize', fontSize);
Of course you need to supply the arrays with the known stock prices and the dates.

Categories

Asked:

on 17 Sep 2013

Community Treasure Hunt

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

Start Hunting!