Group Abstract Group Abstract

Message Boards Message Boards

0
|
6.9K Views
|
11 Replies
|
8 Total Likes
View groups...
Share
Share this post:
GROUPS:

2D gaussian nonlinearmodefit

Posted 10 years ago
POSTED BY: fary farfar
11 Replies

Hi,

you might want to try EstimatedDistribution instead. I don't have your data, but in the documentation they do fit a multivariate distribution.

bndata = RandomVariate[BinormalDistribution[{1, 2}, {1/3, 4}, 3/4], 1000];
dist = EstimatedDistribution[bndata, BinormalDistribution[{Subscript[\[Mu], 1], Subscript[\[Mu], 2]}, {Subscript[\[Sigma], 1], Subscript[\[Sigma], 2]}, \[Rho]]]

Cheers,

Marco

POSTED BY: Marco Thiel
Posted 10 years ago

I can see calculating both as a quality assurance check. But if they differ by any amount (even a small amount), then why would you choose one over the other? My point is that your objective (prior to looking at the fit) should be used to decide which number to use. Otherwise you just have two different estimates.

POSTED BY: Jim Baldwin
Posted 10 years ago
POSTED BY: Jim Baldwin
Posted 10 years ago
POSTED BY: Jim Baldwin
Posted 10 years ago

I suspect that the initial issue with NonlinearModelFit is that your data is not in the correct format. The following might be considered:

data = Import["Z2.dat"];
z2 = Flatten[Table[{x, y, data[[x, y]]}, {x, 202}, {y, 101}], 1];

This gets you a 20,402 x 3 array (which is what NonlinearModelFit expects: {x,y,z} are the 20,402 "data points") rather than a 202 x 101 array. I would also suggest keeping your variables in lowercase (as all of Mathematical functions start in uppercase) and avoiding subscripts (unless there is some very special need for formatting purposes).

I've just used the indices for the values of x and y as I can't tell what those should be from your dataset.

POSTED BY: Jim Baldwin
Posted 10 years ago
POSTED BY: Jim Baldwin
Posted 10 years ago

Yes. But I would also get the sum of my data "z2c" to compare it with the integration of the fit, to know the difference.

POSTED BY: fary farfar
Posted 10 years ago
POSTED BY: fary farfar
Posted 10 years ago

Thnx for the answers. Those are pixel values and here is 202x202 data: http://expirebox.com/download/4e5038c0edae938ffdcdde24e10ec191.html

POSTED BY: fary farfar
Posted 10 years ago

How would it be if I want to use FindFit for this matter?

POSTED BY: fary farfar
Posted 10 years ago

Thanks, here's my data: http://expirebox.com/download/001c9c77bde9bf47238279b3c81694bd.html Somehow your suggestion didn't work.

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