Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
Surf function problem.

Subject: Surf function problem.

From: strat

Date: 26 Jan, 2011 16:36:03

Message: 1 of 2

Greetings to the community :)

I have a problem drawing a surface for a regression… I have 3 vectors Y, X1, X2 and I have estimated the multiple linear regression: Y=c+a*X1+b*X2+u I would like to draw the graph of this regression: Y=c+a*X1+b*X2+u using a matlab plot-graph. I have tried the ''surf'' function but I get this error ''Matrix dimensions must agree''.

I have done these things so far. 1) Estimate the coefficients (c,a,b). 2) Make a new serie [f=Y(estimated)], using the estimated coefficients (c,a,b).New serie: f=c+a*X1+b*X2 3) Use the ''surf'' function . Surf(X1,X2,f)

Can someone help me? I can’t understand what I am doing wrong…:/

P.S. I use matlab 6.5

Subject: Surf function problem.

From: Sean de

Date: 26 Jan, 2011 16:45:04

Message: 2 of 2

"strat" wrote in message <ihpihj$m2p$1@fred.mathworks.com>...
> Greetings to the community :)
>
> I have a problem drawing a surface for a regression… I have 3 vectors Y, X1, X2 and I have estimated the multiple linear regression: Y=c+a*X1+b*X2+u I would like to draw the graph of this regression: Y=c+a*X1+b*X2+u using a matlab plot-graph. I have tried the ''surf'' function but I get this error ''Matrix dimensions must agree''.
>
> I have done these things so far. 1) Estimate the coefficients (c,a,b). 2) Make a new serie [f=Y(estimated)], using the estimated coefficients (c,a,b).New serie: f=c+a*X1+b*X2 3) Use the ''surf'' function . Surf(X1,X2,f)
>
> Can someone help me? I can’t understand what I am doing wrong…:/
>
> P.S. I use matlab 6.5

See my answer in "Answers"

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us