Message Boards Message Boards

GROUPS:

Help fitting and selecting data?

Posted 2 months ago
504 Views
|
7 Replies
|
3 Total Likes
|

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

7 Replies
Posted 2 months ago

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.

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.

Posted 2 months ago

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}} *)

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

Posted 2 months ago

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"]

enter image description here

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.

Posted 2 months ago

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?

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract