Kindly find the data:
https://drive.google.com/file/d/1Zw_GBnhFYbEglEKzTXnCv4o5xEMMT9n1/view?usp=sharing
I want to fit my data. After using drop and select, I am getting blank {}. I want to fit my data of XZ Plane and potential. Kindly help, as soon as possible
Hi Soumyaranjan,
This is an empty list, so all of the data is being filtered out, so DataxzStein is empty.
Select[DataxyzStein, -10^-7 <= #[[2]] <= 10^-7 &]
There are four columns in the data which columns are x, y, z? What is the fourth column?
Hi Rohit !!
1st 3 columns are x, y and z, respectively. The 4t one is the Electric Potential which is a function of x, y and z. Since I want to fit in the XZ plane, so I want to drop the y column.
Please help me to fit those data.
Thank you for your time and consideration.
Extract columns 1, 3, 4
DataxzStein = DataxyzStein[[All, {1, 3, 4}]]
FittXZStein =
NonlinearModelFit[
DataxzStein, {ModelxzStein}, {Subscript[T, 0], Subscript[T, 2],
Subscript[T, 4], Subscript[T, 6], Subscript[T, 8], Subscript[T, 10]}, {x, z}]
FittXZStein["RSquared"]
(* 0.9845 *)
FittXZStein["ParameterTable"]
Hi Rohit,
Thank you so much for your time and consideration. But let’s say I want to extract a specific range of data from my column data points for fitting; how to do that?
Sorry for the silly question. For a beginner, I am struggling to learn. It would be helpful if you answer this.
Regards,
Soumyaranjan
Something like this?
(* MinMax for x, y, z, p *)
MinMax /@ Transpose@DataxyzStein
(* {{-0.495, 0.495}, {-0.495, 0.495}, {-0.305, 0.305}, {0.299106, 0.998006}} *)
(* Select positive x values *)
DataxzSteinPosX = Select[DataxzStein, #[[1]] >= 0 &]
MinMax /@ Transpose@DataxzSteinPosX
(* {{0.005, 0.495}, {-0.305, 0.305}, {0.302262, 0.998001}} *)
I mean to say. I want to command Mathematica that Please select data points with a range from ( -0.32 to +0.32) for x column(1st), a range from ( -0.22 to +0.22) for z column (3rd) along with its corresponding potential data in the 4th columns. Then I will use those data points for fitting.
Add whatever filtering on values you want
(* In DataxzStein, x is column 1 and z is column 2 *)
DataxzSteinSubset =
Select[DataxzStein, Between[#[[1]], {-0.32, 0.32}] && Between[#[[2]], {-0.22, 0.22}] &]
MinMax /@ Transpose@DataxzSteinSubset
(* {{-0.315, 0.315}, {-0.215, 0.215}, {0.447852, 0.889891}} *)
Use DataxzSteinSubset to fit.