Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am now trying a slightly more complicated model which actually consists of finding the parameters of 2 particles in an Image (I attached an Plot of an image). Although I put very good initial values and constrains Mathematica wasn’t able to produce a result. Note at the final stage I will need to decompose the location of 4 particles...

J[i_, j_, α_, β_, xpos_, ypos_, clip_] := N[Clip[(β α^2*π)/ 4*((Erf[(j - xpos)/α ] - Erf[(j + 1 - xpos)/α ])*(Erf[(i - ypos)/α ] - Erf[(i + 1 - ypos)/α ])), {0, clip}]];
PixelImage[mat_]:=ArrayPlot[Rescale[mat,{0,Max[mat]},{Max[mat],0}],Epilog->{Red,MapIndexed[Text[#1,Reverse[#2-1/2]]&,Reverse[mat],{2}]},Mesh->True];
MyThreshold = 4043;
model1 = Clip[N[(β1 α1^2*π)/4*((Erf[(j - xpos1)/α1 ] - Erf[(j + 1 - xpos1)/α1 ])*(Erf[(i-ypos1)/α1 ] - Erf[(i + 1 - ypos1)/α1]))], {0,MyThreshold}];
model2 = Clip[N[(β2 α2^2*π)/4*((Erf[(j - xpos2)/α2 ] - Erf[(j + 1 - xpos2)/α2 ])*(Erf[(i -ypos2)/α2 ] - Erf[(i + 1 - ypos2)/α2]))], {0, MyThreshold}];
Model = Clip[(model1 + model2), {0, MyThreshold}];
data1 = Flatten[Table[{i, j, J[i, j, 0.7, 500, 6.5, 6.5, MyThreshold]}, {i, 1, 14}, {j, 1, 14}], 1];
data2 = Flatten[Table[{i, j, J[i, j, 0.6, 300, 4.5, 4.2, MyThreshold]}, {i, 1, 14}, {j, 1, 14}], 1];
Data = Transpose[{data1[[All, 1]], data1[[All, 2]], Clip[data1[[All, 3]] + data2[[All, 3]], {0, MyThreshold}]}];
PixelImage[Round[Partition[Data[[All, 3]], 14]]]

nlm = NonlinearModelFit[Data, {Model,
    {0.4 <= α1 <= 0.8, 0 <= β1 <= 6000, 0 <= xpos1 <= 8, 
     0 <= ypos1 <= 8, 0.4 <= α2 <= 0.8, 0 <= β2 <= 6000, 
     0 <= xpos2 <= 8, 0 <= ypos2 <= 8}}, {{α1, 0.6}, {β1,
      300}, {xpos1, 6.5}, {ypos1, 6.5}, {α2, 0.6}, {β2, 
     300}, {xpos2, 4.5}, {ypos2, 4}}, {i, j}, Method -> "NMinimize"];
nlm["BestFitParameters"]
share|improve this question

closed as off-topic by MarcoB, RunnyKine, Louis, Yves Klett, ubpdqn Apr 20 at 6:49

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "The question is out of scope for this site. The answer to this question requires either advice from Wolfram support or the services of a professional consultant." – MarcoB, RunnyKine, Louis, ubpdqn
If this question can be reworded to fit the rules in the help center, please edit the question.

    
This is your 5th question here, so: 1. please make sure you use the formatting tools to make the question readable. 2. try to make the question self contained and intelligible, don't rely on some other post you made that people may or may not have seen. I don't even see a question in your post. You can't expect any better answers than the quality of your question. – Szabolcs Dec 14 '13 at 16:38
    
Dear Szablocs. i wasnt tring to be rude. The moment i realised the format mistake you already fixed it and dint have the chance to do it my self. My question was about not being able to get a result from this model. (I tried to related this question to previus ones but there were too many charachters and i passes the limit.) I guess too many questions in the same subjeuct are not welcome. Sorry – Doron Dec 14 '13 at 16:42

Browse other questions tagged or ask your own question.