In lsqcurvefitting program showing ,QUITE DEBUGGING, how to relve this issue
Info
This question is closed. Reopen it to edit or answer.
Show older comments
function[modZ,Mr]=impedance_test52(var,field)
M=var(1);Ha=var(2);sig2=var(3);alpha=var(4);D=var(5);teta=var(6);si=var(7);
%Define constants
g=((2.2).*(10e5));
w=((10).*(10e6));
M0=((4).*(pi).*(10e-7));
sig1=(0.57)*(10e8);
c=3*(10e10);
d=(0.1)*(10e-3);
l=3;
% Define function.
R=((4.*l)./pi).*(1./((sig1.*d^2)+(sig2).*(D^2-d^2)));
wm=g.*4.*(pi).*M;
w1=g.*((Ha.*(cosd(teta-si)).^2)+((field).*(sind(teta))));
w2=g.*((Ha.*(cosd(2.*(teta-si))))+((field).*(sind(teta))));
%Relative permeability
Mr=(wm.*(wm+w1-(1i.*(alpha).*w)))./(((wm+w1-(1i.*(alpha).*w)).*(w2-(1i.*(alpha).*w)))-(w.^2));
Mr=abs(Mr);
Mef=Mr.*M0;
T2=c./(sqrt(2.*(pi).*(sig2).*w));
Z=((((1-1i).*l).*(((sqrt(Mef+1)).*((sind(teta)).^2))+(cosd(teta)).^2)./((pi).*(sig2).*D.*T2)))./R;
modZ=(((abs(Z)./(2.34401312390370e-09))-1).*100);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
end
clc;
clear;
close all;
load('mat52.txt');
field= mat52(:,1);
Z= mat52(:,2);
plot(field,Z,'bo');
hold on;
lb=[90*(10e3),1,5*10e9,0.001,0.1*10e-6,50,0.1];
ub=[100*(10e3),10,900*10e9,1,151*10e-6,98,10];
MI=lsqcurvefit(@impedance_test52,[900,3,20*10e9,5,16*10e-6,59,1],field,Z,lb,ub);
[fitdata,Mr]=impedance_test52(MI,field);
plot(field, fitdata,'-r','LineWidth',2);
xlabel('Field');
ylabel('MI');
legend('mat52','fitting')
title('MI vs Field')
0 528.77027
0.8 551.70746
1.6 576.78561
2.4 597.14538
3.2 601.62784
4 605.07225
4.8 599.59894
5.6 590.33324
6.4 575.99528
7.2 560.74904
8 545.81539
8.8 528.67591
9.6 511.5895
10.4 494.85108
11.2 477.58773
12 460.04718
12.8 443.32055
13.6 426.06901
14.4 410.96432
15.2 395.31112
16 379.55765
20 311.6072
24 257.21026
28 212.94603
32 177.72339
36 149.07697
40 125.61486
when i run this program, is not fitting and showing QUITE DEBUGGING ,How can we solve this , can u pls help me in this issue.
4 Comments
Shubh Sahu
on 9 Aug 2019
Edited: Shubh Sahu
on 9 Aug 2019
Can you share "mat52.txt" and which version of MATLAB you are using?
sumalatha vasam
on 9 Aug 2019
sumalatha vasam
on 9 Aug 2019
Answers (0)
This question is closed.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!