Adapt the dollar exchange rate to a linear model

In this program I upload the file "dollarkurs09_10", which is a one column text file containing the dollar exchange rate. The code which I've written is:


clear all, close all

load dollarkurs09_10.txt
y = dollarkurs09_10(:,1);
x = 1: length(y);

plot(x,y)

%Now I want to adapt a linear model f(x) = c1+c2*x to the exchange rate.
A = [ones(size(x)) x];
c = Ay; [color=Red]%This is where it goes wrong[/color]
f = @(x) c(1)+c(2)*x;
tt = linspace(x(1),x(end));
plot(x,y,'*',tt,f(tt),'b-');


Can't figure out what i did wrong here. Anyone willing to give me a helping hand?

Comments

  • You are trying to divide a 1x20 vector to a 1x10 vector.

    Probably you are wrong in the contruction of the matrix A.
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion