high frequency fitting problem
hallo, i have a question about high freq fitting. I have used RL to fit but seems does not work.
the fitting of positive Zimg is not possible
can anyone maybe know why?plz
@Yugal0
Although I will give it a try myself tomorrow, but for now I think you can try increasing the value of inductance in the initial guess.
Although I will give it a try myself tomorrow, but for now I think you can try increasing the value of inductance in the initial guess.
thank you for the suggestion. I have tried to increase the value of inductor, but still can not get the the fitting of positive Zimag. the csv i use is from the exampleData.csv.
Although I will give it a try myself tomorrow, but for now I think you can try increasing the value of inductance in the initial guess.
thank you for the suggestion. I have tried to increase the value of inductor, but still can not get the the fitting of positive Zimag. the csv i use is from the exampleData.csv.
Ok I will try fitting myself.(tommorow)
What I got in the first try:
from impedance.models.circuits import CustomCircuit
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
initial_guess=[0.01,0.01,100,0.01,0.05,100,1,1,0.1]
c=CustomCircuit("R0-p(R1,C1)-p(R2-Wo1,C2)-p(L1,R3)",initial_guess=initial_guess)
df=pd.read_csv("../exampleData.csv")
gthbdata=df.to_numpy()
datanew=np.transpose(gthbdata)
freq=datanew[0]
z_data=datanew[1]+1j*datanew[2]
plt.plot(np.real(z_data),-np.imag(z_data))
c.fit(frequencies=freq,impedance=z_data)
print(c)
z_fit=c.predict(frequencies=freq)
plt.plot(np.real(z_fit),-np.imag(z_fit))
plt.plot(np.real(z_data),-np.imag(z_data))
print(c.conf_)
What I got in the first try:
from impedance.models.circuits import CustomCircuitimport numpy as npimport pandas as pdimport matplotlib.pyplot as plt
initial_guess=[0.01,0.01,100,0.01,0.05,100,1,1,0.1]c=CustomCircuit("R0-p(R1,C1)-p(R2-Wo1,C2)-p(L1,R3)",initial_guess=initial_guess)df=pd.read_csv("../exampleData.csv")gthbdata=df.to_numpy()datanew=np.transpose(gthbdata)freq=datanew[0]z_data=datanew[1]+1j*datanew[2]plt.plot(np.real(z_data),-np.imag(z_data))
c.fit(frequencies=freq,impedance=z_data)print(c)z_fit=c.predict(frequencies=freq)plt.plot(np.real(z_fit),-np.imag(z_fit))plt.plot(np.real(z_data),-np.imag(z_data))![]()
thank you for your try, so as I see in the last picture, the fitting line also can not reach the positive Zimag?
What I got in the first try:
from impedance.models.circuits import CustomCircuitimport numpy as npimport pandas as pdimport matplotlib.pyplot as pltinitial_guess=[0.01,0.01,100,0.01,0.05,100,1,1,0.1]c=CustomCircuit("R0-p(R1,C1)-p(R2-Wo1,C2)-p(L1,R3)",initial_guess=initial_guess)df=pd.read_csv("../exampleData.csv")gthbdata=df.to_numpy()datanew=np.transpose(gthbdata)freq=datanew[0]z_data=datanew[1]+1j*datanew[2]plt.plot(np.real(z_data),-np.imag(z_data))![]()
c.fit(frequencies=freq,impedance=z_data)print(c)z_fit=c.predict(frequencies=freq)plt.plot(np.real(z_fit),-np.imag(z_fit))plt.plot(np.real(z_data),-np.imag(z_data))![]()
thank you for your try, so as I see in the last picture, the fitting line also can not reach the positive Zimag?
Yes, same problem as yours happening.
But I made another mistake, the plots are not 1:1 in aspect ratio.
And also, seems like the fit you are getting and what I am getting are different, why so? what method are you using for fitting?
YOUR FIT:
MY FIT: (now its 1:1)
What I got in the first try:
from impedance.models.circuits import CustomCircuitimport numpy as npimport pandas as pdimport matplotlib.pyplot as pltinitial_guess=[0.01,0.01,100,0.01,0.05,100,1,1,0.1]c=CustomCircuit("R0-p(R1,C1)-p(R2-Wo1,C2)-p(L1,R3)",initial_guess=initial_guess)df=pd.read_csv("../exampleData.csv")gthbdata=df.to_numpy()datanew=np.transpose(gthbdata)freq=datanew[0]z_data=datanew[1]+1j*datanew[2]plt.plot(np.real(z_data),-np.imag(z_data))![]()
c.fit(frequencies=freq,impedance=z_data)print(c)z_fit=c.predict(frequencies=freq)plt.plot(np.real(z_fit),-np.imag(z_fit))plt.plot(np.real(z_data),-np.imag(z_data))![]()
thank you for your try, so as I see in the last picture, the fitting line also can not reach the positive Zimag?
Yes, same problem as yours happening. But I made another mistake, the plots are not 1:1 in aspect ratio. And also, seems like the fit you are getting and what I am getting are different, why so? what method are you using for fitting? YOUR FIT:
MY FIT: (now its 1:1)
do you have the same initial guess of mine? Maybe i have add another (RC) component, because (RC) is responsible for semicircle part.
yes I put the exact same initial guess (and the same elements) as you showed in the code in your very first snapshot in the question.
YOUR SNAPSHOT of CODE:
Actually just now, what I found is if I take L=100 as the initial guess the I am getting a pretty good fit
MY FIT NOW:
In your snapshot it was L=1, with that I was getting not a good fit (as shown in my previous comments)
MY FIT BEFORE:
But still how you getting good fit with L=1 as initial guess?
YOUR FIT as shown in your first comment:
yes I put the exact same initial guess (and the same elements) as you showed in the code in your very first snapshot in the question. YOUR SNAPSHOT of CODE:
Actually just now, what I found is if I take L=100 as the initial guess the I am getting a pretty good fit MY FIT NOW:
In your snapshot it was L=1, with that I was getting not a good fit (as shown in my previous comments) MY FIT BEFORE:
But still how you getting good fit with L=1 as initial guess? YOUR FIT as shown in your first comment:
Maybe I have changed the value of L , but the problem still remains. The high frequency fitting can not be reached.
Yeah, that is the main problem. I will let you know here, If I get any solutions for this.
(And also, please don't quote the previous comments in the chat, every time you write a new comment, it makes the chat difficult to read sometimes)
Yeah, that is the main problem. I will let you know here, If I get any solutions for this.
But totally thank you for replying me! If I find any solutions, I will post here


MY FIT: (now its 1:1) 

In your snapshot it was L=1, with that I was getting not a good fit (as shown in my previous comments) MY FIT BEFORE: 
