Fitting 4 data sets to non-linear least squares

조회 수: 1 (최근 30일)
jgd0008
jgd0008 2016년 12월 1일
편집: jgd0008 2016년 12월 2일
Hello there,
Im trying to fit 4 data sets to an analytical model. Im looking for K1, where K1(u,v,r,theta). It gives me a "Exiting due to infeasibility: 1 lower bound exceeds the corresponding upper bound" error I´m pretty sure is because the 4 parameters as lsqcurvefit seems it works only with 2 sets of data, and I have 4. For data, you can use the attached txt file. Thanks in advance JGD0008
This is my code: *************
clear all; close all; clc; format long
E=200000; % MPa
nu=0.3; % poisson
global G k u v;
G=E/(2*(1+nu)); % shear mod
k=(3-nu)/(1+nu); %kolosov
A = xlsread('img55_DCT.xlsx'); %excel file with experimental data
x=A(:,1); y=A(:,2);
u=A(:,3);
v=A(:,4);
[m,n]=size(A);
r=zeros(m,1);
theta=zeros(m,1);
for i = 1:1:m %angle rotation according to Irving´s Ref System (X to left, Y down)
r(i,1)=sqrt(x(i,1)^2+y(i,1)^2);
if x(i,1) >= 0 && y(i,1)>=0 % I Q
theta(i,1)=acos(x(i,1)/r(i,1)); %IQ
end
if x(i,1) < 0 && y(i,1)>=0 % II Q
theta(i,1)=acos(x(i,1)/r(i,1)); %II Q
end
if x(i,1) < 0 && y(i,1)<0 % III Q
theta(i,1)=-acos(x(i,1)/r(i,1)); %-I Q
end
if x(i,1) > 0 && y(i,1)<0 % IV Q
theta(i,1)=-acos(x(i,1)/r(i,1)); %-II Q
end
end
% x0 = [1 25]; % initial guess K1 & K2
x0 = 30; % initial guess K1
% [K1, K2] = lsqcurvefit(@series,x0,r,theta); % two parameters
[K1, resnorm]= lsqcurvefit(@series,x0,r,theta, u, v);
****************
%function
function fseries = series(K1,r,theta)
global G k u v;
fseries=2*G*sqrt(2*pi./r)*(u./(sin(theta/2)*(k+1+2*(cos(theta/2))^2))-v./(cos(theta/2)*(k-1-2*(sin(theta/2))^2)))-K1(1);
***************
  댓글 수: 2
Alan Weiss
Alan Weiss 2016년 12월 1일
Please edit your code using the {} Code button so that we can read it.
Alan Weiss
MATLAB mathematical toolbox documentation
jgd0008
jgd0008 2016년 12월 2일
thanks

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Support Vector Machine Regression에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by