Welcome Guest, Not a member yet? Register   Sign In
Undefined variable data
#1

[eluser]Unknown[/eluser]
Hello,
I'm a relative rookie in writing code, so I hope this is a easy one Smile:

following error is making me crazy for a while:

Undefined variable data.

Error in HSP (line 10)
delta_d=(data(:,1))';

I don't see what is wrong in underneath script:

clc
clear all
Solvents_Database;
delta_d=(data(:,1))';
delta_p=(data(:,2))';
delta_h=(data(:,3))';
solubility=(data(:,4))';
a(1)=mean(delta_d);
a(2)=mean(delta_p);
a(3)=mean(delta_h);
a(4)=sqrt(a(1)^2+a(2)^2+a(3)^2);
guess=a;
options=optimset('Display','off');
res=1;
while res>1e-4;
[delta res]=fminsearch(@QF,guess,options,delta_d,delta_p,delta_h,solubility,n);
guess=delta;
end
d_d=delta(1); d_p=delta(2); d_h=delta(3); R_o=delta(4);
R_a=sqrt(4*(d_d-delta_d).^2 + (d_p-delta_p).^2 +(d_h-delta_h).^2);
RED=(R_a/R_o);
clc
disp('*********************************************************')
disp('Delta_d Delta_p Delta_h Solub RED')
disp('*********************************************************')
disp([delta_d' delta_p' delta_h' solubility' RED'])
disp('Data Fit ==')
Data_Fit=1+QF(delta,delta_d,delta_p,delta_h,solubility,n);
disp(Data_Fit)
disp('Delta_d Delta_p Delta_h R_o')
disp([d_d d_p d_h R_o])

best regards !




Theme © iAndrew 2016 - Forum software by © MyBB