Mathematica: how can I simulate RC and get R and C values ​​from CSV

I hope someone can help me.

I have a CSV file with Response and current step parameters. I have to make an RC model in math and find the values ​​of R and C.

How can I simulate RC in math and extract parameters from values ​​in a CSV file?

I have done this:

Data=Import["T:/file.csv","CSV"]; 

My data has a header and 2 columns. column for current and column for voltage response.

 Voltage=data[[35;;,1]];Current=data[[35;;,2]]; 

My file has a header, which is why I am writing 35 to remove the header. Hier ist my current stepHier ist my voltage response

So now I have an RC model with a resistor parallel to the capacitor, and serial with another resistor My rc model

 Z= Ri+Rt//Ct --> complex Form (Ri+Rt/1+jwR2Ct) 

My math model is as follows:

 OutputResponse[StateSpaceModel[TransferFunction[{{Ri+Rt+sRt}/{1+sRt}},s,SamplingPeriod->0.1,SystemsModelLabels->None]],current]; 

how to extract Ri Rt und Ct from a voltage response to put them in my Transferfunction in order to get the same voltage response as in picture 2

+4
source share
1 answer

I'm not sure I fully understand your question.
Is this the following: do you have a CSV data file containing a table of values ​​for your variables Ri , Rt and Ct , and you want to connect them to your formula?

If so, you can first define a function

 response[Ri_ , Rt_, Ct_] := OutputResponse[... (as above) 

Then suppose your Data is a table that has these values ​​in columns 1, 2, and 3 (you may need to accept this).

Then you could:

 Map[Function[r, response[r[[1]], r[[2]], r[[3]]], Data] 

To get a table with the results.

0
source

All Articles