using lsqnonlin with constraints
Afficher commentaires plus anciens
clc
clear all
%read in text data
D=readmatrix('Treloar_data.xlsx');
stretch=D(1:end,1); %this is lambda
lambda=stretch;
stress=D(1:end,2); %this is stress
T_0=stress;
u=.5673; %small strain shear modulus, mu
%constrained
fun=@(x)(2*(lambda-lambda.^-2).*(x(1)+(lambda.^-1).*x(2))-T_0);
x0=[-100000,100000]; %initial guess
%constraints
% A=2*(c(1)+c(2))==u this is the constraint i want to use
lb=[0,0]
ub=[10,10]
x=lsqnonlin(fun,x0,lb,ub);
c(1)=x(1)
c(2)=x(2)
T_MR=2*(lambda-lambda.^-2).*(c(1)+(lambda.^-1).*c(2));
figure
plot(lambda, T_0,'o'), xlabel('stretch'), ylabel('stress'), title('UT')
hold on
plot(lambda, T_MR)
i want to employ a constraint that involves both constants if possible as labeled
Réponse acceptée
Plus de réponses (1)
Jon
le 6 Avr 2023
0 votes
From my understanding lsqnonlin only allows for bound constraints on the components of x. For more general problems you will have to use fmincon
1 commentaire
Catégories
En savoir plus sur Stress and Strain dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!