How do I produce a graph of the slope of a group of data points?

I am currently working with a set of historical price points, and I am looking to graph the slope of the changes over time. The data, however, is too erratic to create an effective best fit curve. I am fairly unfamiliar with Matlab. Is there a way to do this effectively?

11 件のコメント

José-Luis
José-Luis 2014 年 6 月 12 日
Probably. People here would need more details to help you efficiently though.
Mark
Mark 2014 年 6 月 12 日
Forgive me, I know my question isn't the clearest. Would it help if I sent you the data? I'd be happy to do anything I can.
José-Luis
José-Luis 2014 年 6 月 12 日
No worries. You could always post your data here and see if people are willing to help. However, the best way to get help is to show some effort yourself. Please show what you have tried and ask specific questions.
If there was an easy way to simulate price changes over time, there would be a lot of millionaires around here.
Mark
Mark 2014 年 6 月 12 日
I have attached the data. All I have been able to do is graph it, as I just touched Matlab for the first time about an hour ago. I am looking to make a graph of how the slope changes over time. I'm really quite lost.
I'm not trying to simulate how they will change, just analyze how they did! I wish there was an easy way to predict price changes though! And thank you so much for helping me thus far.
José-Luis
José-Luis 2014 年 6 月 12 日
To plot the slope:
plot(diff(your_data))
Since you are just starting with Matlab, I strongly recommend you to read the "Getting started" part of the documentation.
Star Strider
Star Strider 2014 年 6 月 12 日
編集済み: Star Strider 2014 年 6 月 12 日
No data attached.
Use the ‘paperclip’ icon next to the ‘Help’ button.
Mark
Mark 2014 年 6 月 12 日
It should be attached now. I entered in the data, but it gives me the error "Difference order N must be a positive integer scalar". I am looking through the "Getting Started" section now.
José-Luis
José-Luis 2014 年 6 月 12 日
doc xlsread
to import data from excel
Mark
Mark 2014 年 6 月 12 日
I've been able to import the data and graph the plain data, it's the plot(diff line that is presenting the error.
José-Luis
José-Luis 2014 年 6 月 12 日
What is the command you are using?
Mark
Mark 2014 年 6 月 12 日
I originally graphed by using:
[num,txt,raw]=xlsread('Metal Data.xlsx') x = num(1:57,1); y = num(1:57,2); plot(x,y)
That gave me the base plow. I then tried to input the line that you gave me:
plot(diff(x,y));
but it gave me the aforementioned error.

サインインしてコメントする。

 採用された回答

José-Luis
José-Luis 2014 年 6 月 12 日

0 投票

plot(diff(y));
Please read the documentation to see how diff() works.
Please accept an answer when your problem has been solved.

2 件のコメント

Mark
Mark 2014 年 6 月 12 日
Thank you so much for your help, my boss likes your answer!
José-Luis
José-Luis 2014 年 6 月 12 日
編集済み: José-Luis 2014 年 6 月 12 日
My pleasure.
Tell your boss he can give me a job if he wants to... ;)

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeTimetables についてさらに検索

質問済み:

2014 年 6 月 12 日

編集済み:

2014 年 6 月 12 日

Community Treasure Hunt

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

Start Hunting!

Translated by