run the function with different variables

Hi all, I am a new hand in Matlab and want to seek some of your valuable advise
I have 1000 different sets of parameters for a function, how can I run a set of the parameter each time? What should I write in the script to recall the value of the parameters in the excel? MY function is like this
function [error] =stress5_function(Ke,n,Sult,u,t,S0,k,m)
pa=0.1013 ;
S3=5 ;
Ei=Ke.*pa.*(S3./pa).^n;
Rf=(S0+k.*exp(-(S3./m)))./(Sult+u.*exp(-(S3./t)));
% z=(σ1-σ3)
z=0:0.0001:5;
Et=Ei.*(1-(Rf.*z)./(S0+k.*exp(-(S3./m))));
Et(Et<0)=0;
x=(z./Et).*100;
A=xlsread('5MPa','A1:A32');
B=A';
C=xlsread('5MPa','B1:B32');
D=C';
startingIndex = find(x==0);
endingIndex = find(x>=16);
desiredX = x(startingIndex:endingIndex);
desiredZ = z(startingIndex:endingIndex);
A1 = trapz(desiredX,desiredZ);
A2= trapz(B,D);
err= ((A1-A2)./A1)*100;
display(err,'error %');
end
I tried something like this
stress5_function([1115 1116],[0.3 0.4], [2.7 2.8], [22 23],[1.11 1.8],[2.677 4.462],[30.9 50],[0.97 1.5])
but it doesn't work Can someone please help!!

1 Comment

Jan
Jan on 23 Feb 2016
Edited: Jan on 23 Feb 2016
Please explain "it doesn't work" with any details. It is easier to solve a problem, than to guess it.
The function replies "error", but the name of the variable seems to be "err".

Sign in to comment.

Answers (0)

Tags

Asked:

on 23 Feb 2016

Edited:

Jan
on 23 Feb 2016

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!