curve fitting of a complex equation
Show older comments

omega=[0 500 1000 1500 2000 2500 3000 3500 4000 4500 5000 5500 6000 6500 7000 7500 8000 8500 9000 9500 10000 10500 11000 11500 12000 12500 13000 13500 14000 14500 15000];
ydata1=[0 2.773974956 9.859008802 19.20487131 29.60850853 40.54661158 51.7216818 62.90316231 73.8967491 84.55521774 94.77825113 104.5075664 113.7172145 122.4051971 130.5842098 138.2785508 145.5166646 152.3241086 158.7410015 164.7940864 170.5138742 175.9234703 181.0507873 185.9164421 190.5396332 194.9419395 199.1392141 203.1447385 206.9756021 210.6403678 214.1499578];
ydata2=[0 23.23166979 43.89101766 61.37336819 76.13374067 88.63427978 99.17236163 107.96827 115.2289659 121.1585778 125.9542122 129.7976768 132.8504967 135.2544369 137.1234954 138.5545735 139.6310041 140.4137722 140.960863 141.3115956 141.5020398 141.5603911 141.5098635 141.3688178 141.150192 140.8714973 140.5392011 140.1625248 139.7464364 139.3025573 138.8344027];
I want to curve fit the above equation to this data
ydata1 is for real part, and ydata2 is for imaginary part, my doubt is whether i should separate real and imaginary part, and solve it separately. Or should i try to solve it together, i have tried both the ways and i am not getting the proper answer.
ANSWER FOR K1 IS 204419 AND K2 IS 160380, C1 =102.884 AND C2=326.123
any hints in this regard would be appreciated
8 Comments
Supreeth D K
on 27 Jul 2023
Alex Sha
on 28 Jul 2023
@Supreeth D K,does your fitting function look like below? where k1, k2, c1, c2, w1, w2 are parameters needed to be estimated, q is a constant of 0.01

if the above is corrected, the best result will then be:
Sum Squared Error (SSE): 46.424449856966
Root of Mean Square Error (RMSE): 0.865321587218246
Correlation Coef. (R): 0.999869229000882
R-Square: 0.999738475102819
Parameter Best Estimate
--------- -------------
k1 181.203558111029
k2 13247.6132403486
c1 -1.42262791216218
c2 -2.96730197634771
w1 -14713.9170455795
w2 -4222.15402974947


Supreeth D K
on 28 Jul 2023
Edited: Supreeth D K
on 28 Jul 2023
Alex Sha
on 28 Jul 2023
Yes, simultaneously.
If you think "K1 =204419 AND K2 IS 160380, C1 =102.884 AND C2=326.123" being right answers, how about another two parameters w1 and w2?
Supreeth D K
on 28 Jul 2023
Alex Sha
on 28 Jul 2023
if w1=k1/c1 w2=k2/c2, then:
Sum Squared Error (SSE): 318.329366755648
Root of Mean Square Error (RMSE): 2.26590922701928
Correlation Coef. (R): 0.999027013165415
R-Square: 0.998054973034211
Parameter Best Estimate
--------- -------------
k1 1761183.84910946
k2 20644.014228873
c1 -0.505604385784565
c2 -3.67185412002803


"K1 =204419 AND K2 IS 160380, C1 =102.884 AND C2=326.123" are complete far away from right solution.
Supreeth D K
on 28 Jul 2023
Alex Sha
on 29 Jul 2023
Hi, @Supreeth D K, the result provided above was obtaind by using a package other than Matlab, the code likes below, very simple. It is easy to make a judgement of goodness by taking the results back to Matlab.
ConstStr w1=k1/c1, w2=k2/c2;
ComplexStr = j;
Parameter k(2),c(2);
Variable omega,y[realPart],y[imagPart];
Function y=(k1/(1+(w1/omega)^2))+(k2/(1+(w2/omega)^2))*q-j*((c1*omega/(1+(omega/w1)^2)+(c2*omega/(1+(omega/w2)^2))))*q;
Data;
omega=[0,500,1000,1500,2000,2500,3000,3500,4000,4500,5000,5500,6000,6500,7000,7500,8000,8500,9000,9500,10000,10500,11000,11500,12000,12500,13000,13500,14000,14500,15000];
y_real=[0,2.773974956,9.859008802,19.20487131,29.60850853,40.54661158,51.7216818,62.90316231,73.8967491,84.55521774,94.77825113,104.5075664,113.7172145,122.4051971,130.5842098,138.2785508,145.5166646,152.3241086,158.7410015,164.7940864,170.5138742,175.9234703,181.0507873,185.9164421,190.5396332,194.9419395,199.1392141,203.1447385,206.9756021,210.6403678,214.1499578];
y_image=[0,23.23166979,43.89101766,61.37336819,76.13374067,88.63427978,99.17236163,107.96827,115.2289659,121.1585778,125.9542122,129.7976768,132.8504967,135.2544369,137.1234954,138.5545735,139.6310041,140.4137722,140.960863,141.3115956,141.5020398,141.5603911,141.5098635,141.3688178,141.150192,140.8714973,140.5392011,140.1625248,139.7464364,139.3025573,138.8344027];
Answers (0)
Categories
Find more on Get Started with Curve Fitting Toolbox 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!