Error in inline expression ==> Not enough input arguments.
Show older comments
I hav attached my code below. When i try to run the inline command it always says error in inline expression.
Basically, I'm trying to use cells to process a large amount of data from an FEM software.
Initially, i try to create a stress tensor and then the hydrostatic part and deviatoric part, which are basically matrices.
hypsph is a function consisting of two variables which is also shown below.
S{41976}=zeros(3,3,39);
for col=1:41976
for row=1:39
S{col}(:,:,row) = [S11(row,col), S12(row,col), S13(row,col)
S12(row,col), S22(row,col), S23(row,col)
S13(row,col), S23(row,col), S33(row,col)];
end
end
%% 3. Creating Hydrostatic stress and Deviatoric Stress Tensor
SD{41976}= zeros(3,3,39);
SH{41976}= zeros(1,39);I=eye(3,3);
for col=1:41976
for row=1:39
SH{col}(:,row)=(S{col}(1,1,row)+S{col}(2,2,row)+S{col}(3,3,row))/3;
SD{col}(:,:,row)= S{col}(:,:,row) - (I)*SH{col}(:,row);
Svec{col}(:,:)= [(sqrt(3)/(2*SD{col}(1,1,row)))
SD{col}(2,2,row)-SD{col}(3,3,row)
SD{col}(1,2,row)
SD{col}(1,3,row)
SD{col}(2,3,row)]';
% Svec{col}(1,1,row)=0;
end
end
%% plot
clc
a(:,:)=Svec{2};
J2m_iniz = (max(a) + min(a)) ./2;
f=inline('hypsph','Sp','S');
[J2m,J2ai,J2a] = fminimax(f,J2m_iniz,[],[],[],[],[],[],[],options,a);
%%%%%%%%%% hypsph function
function z = hypsph(radqJ2m,sv)
x1 = radqJ2m(1);
x2 = radqJ2m(2);
x3 = radqJ2m(3);
x4 = radqJ2m(4);
x5 = radqJ2m(5);
z = sqrt( (sv(:,1) - x1).^2 + (sv(:,2) - x2).^2 + (sv(:,3) - x3).^2 + (sv(:,4) - x4).^2 + (sv(:,5) - x5).^2 );
%%%%%%%%%%%
i want to understand why, this error occurs and why.
Accepted Answer
More Answers (0)
Categories
Find more on Function Creation in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!