penny February 13th, 2012
So I’ve been fitting exponential curves into some data points today, continuing from last week. This is when you have at least two sets of values x and y which you are guessing to be related “logistically”, so that you model this relationship by y=b*m^x. Here’s how one plot looks like:
(See MS Excel help page on LOGEST here.)
After which I want to plot these model curves using Matlab, so I am currently “copy-pasting arrays” into the Matlab command window. The job is getting a bit too much with the lot of data I have, so I think it’s time to learn coding in Matlab.
Here’s a very short but useful video tutorial that clearly shows the syntax on how to store results from a for loop into a matrix. I’m no programmer, as I’ve admitted in many a conversation to disclaim my unskilledfulness in coding.
Anyhow, if you can’t see the video, basically all you have to do is define a matrix such as mat(r,:)=y within the for loop, as shown in the example:
for r = 1: 10
y=your formula to get y involving r;
The “:” notation is very useful to refer to an entire column.