Date: Oct 7, 2011 1:48 PM
Author: danilo
Subject: Matlab

Hey guys,
I'm trying to perform a program using matlab, but I got some trouble.
The program should plot a surface this way.
clear all;
/////////////////////////
clc;
%T=290;
phi=14;
A=64;
[T,i_fc]=meshgrid(290:360,0.1:0.01:0.8);
pho_m=[181.6.*(1+0.03.*(i_fc./A)+(0.062.*(T./303).^2).*(i_fc/A).^2.5)]./[(phi-0.634-3.*(i_fc./A)).*(exp(4.18.*(T-303)./T))];
surf(T,i_fc,pho_m);
xlabel('Temperature(k)');
ylabel('Current Density(A/cm²)');
zlabel('Membrane Resistivity');
//////////////////////////////////

But I have a different model that makes this same surface(that's not exactly the same, but it looks like).
In the program above the different is at 'pho_m'.
pho_m=p1+p2*T+p3*i1+p4*T^2
but to perform this equation I need to find the coefficients p1,p2,p3,p4.
And this would be found by using the least square method.

x=inv(A'*A)*A'*b. The problem is when I use this equation to find the values of p1,p2,p3,p4. Matlab gives me this answer:"Matrix is close to singular or badly scaled.
Results may be inaccurate. RCOND = 1.309963e-026."
and gives me the answer, but I think it's not right because when I plot it, the surface is different from the one I found using the first problem I put above.


Message was edited by: danilo