Prev: Slight changes of the existing StyleSheet
Next: difficulty in calculating first two terms of an
From: mike on 3 Jun 2010 05:39 I sometimes import data sets, generate theoretical curves based on some expressions and then plot chi-square plots over a fairly large parameter space. The way I had been doing this was using a dynamic file browser and then something along the lines of the following ***some type of grid or nice frame***, {FileNameSetter[Dynamic[f]], Dynamic[f], s = Take[Import[f, "Table"], All, 2];} (*s is the dataset*, I then pick a range of data I would like to see fit and assign it to a new variable dat1. I choose a subset of the range of values I am interested in fitting by bracketing the x axis and extracting the {x,y} pairs*) dat1={q1 = #[[1]] & /@ Select[s, x <= #[[1]] <= y &], inten = #[[2]] & /@ Select[s, x <= #[[1]] <= y &]}; (*so the x, and y points I want are now labeled q1,and inten. the list pair is given by dat1.*) (*I now take the model and find the theoretical values*) t = Table[{w, l, ((w/2)^2*l*Pi* NIntegrate[(((Sin[(q1*l*Cos[\ [Theta]])/ 2])/((q1*l*Cos[\[Theta]])/2)*(2* BesselJ[1, q1*(w/2)*Sin[\[Theta]]])/(q1*(w/2)*Sin[\ [Theta]]))^2)*Sin[\[Theta]], {\[Theta], 0, Pi/2}]*0.0287462*o*(1 - o))}, {w, 3, 15}, {l, 10,30}]; (*w is a width, l a length, and o is a parameter I provide to the input. To find the chi-square for each set of points I use:*) chi1 = Table[Total[((inten - t[[i, j, All]][[3]])^2)], {i, 1, Dimensions[t][[1]]}, {j, 1, Dimensions[t][[2]]}]; (*the thrid column of the table t is now set to chi, giving a list that reads {w,l,chi-square value} for the entire set of data*) t[All,All,3]=chi (*This is then flattened and is ready for List contour plot*) ss1=Flatten[t,1]; ListContourPlot[ss1, opts...] I have been trying to get this worked into part of a larger routine where a checkbox initiates the entire procedure. If have tried DynamicModule, Manipulate, etc. However the step 'chi1' always fails to sum the difference of between inten and t. I also tried Plus@@chi1 with an extra index . I would like to be able to control the parameters x,y which determine what range of data is evaluated by using an inputfield strucure for parameters x,y,o. What am I doing incorrectly, thanks
|
Pages: 1 Prev: Slight changes of the existing StyleSheet Next: difficulty in calculating first two terms of an |