Group Abstract Group Abstract

Message Boards Message Boards

0
|
9.2K Views
|
7 Replies
|
4 Total Likes
View groups...
Share
Share this post:

Fitting the data (need syntax help)

Posted 11 years ago

hi, Can you please help me to resolve some issues. I am not able to plot the graph from my fitted model. My dataset is of the form (Cb0,te,Ca}. But I am not able to plot the graph of (Ca (on y axis) Vs te (on x axis) using the fitted model. I am attaching the mathematica file as a reference.

Thanks

Thanks, Jaydeep

Attachments:
POSTED BY: Jaydeep Yadav
7 Replies

Oku Nyong: I would suggest that you start a new thread (new subject header and all that) and also include some reasonable example It could be in an attached file if it seems too long to enter directly in the post. It would be best if you also provide the mathematica code you have tried thus far.

Also you might want to look at the documentation for, say, NonlinearModelFit (accessed via Help > Documentation Center).

POSTED BY: Daniel Lichtblau

Hello, I have an issue I'm trying to fit linear piecewise fit into my experimental data to get an approximation.Can anyone assist with a script to do that since I'm new to Mathematica. Thank you.

POSTED BY: Oku Nyong
Posted 11 years ago

Hi, I have made some changes as you said, I guess now the it has worked. But I am still unable to get a the graph showing the data points and the curve from the fitted model.

Please look into it.

Thanks, Jaydeep

Attachments:
POSTED BY: Jaydeep Yadav
POSTED BY: Marco Thiel
Posted 11 years ago
Attachments:
POSTED BY: Jaydeep Yadav

Furthermore, as I explained when you asked before http://community.wolfram.com/groups/-/m/t/283255/ , your fitting procedure is still incorrect. You run

ClearAll[Vmax, Km, fit, Cb0, Fuc, Pdiff, te, Model3];
Model3[Vmax_?NumericQ, Km_?NumericQ, Fuc_?NumericQ, Pdiff_?NumericQ, 
   Cb0_?NumericQ, 
   te_] := (Model3[Vmax, Km, Fuc, Pdiff, Cb0] = 
    Ca[te] /. 
     First[NDSolve[{ 
        Ca'[t] == ((Vmax Cb[t])/(Km + Cb[t]) - Pdiff Fuc Ca[t] + 
            Pdiff Cb[t])/Va, 
        Cb'[t] == (Pdiff Fuc Ca[t] - 
            Pdiff Cb[t] - (Vmax Cb[t])/(Km + Cb[t]))/Vb,
        Ca[0] == 0,
        Cb[0] == Cb0 },
       {Ca, Cb}, {t, 0, 45}, MaxSteps -> 100000, 
       PrecisionGoal -> \[Infinity]]]);

which contains Va and Vb. Then you fit

fit1 = NonlinearModelFit[
  Dataimp, {Model3[Vmax, Km, Fuc, Pdiff, Cb0, te]}, {{Vmax, 
    0.001119}, {Km, 15}, {Fuc, 0.1}, {Pdiff, 0.000000345}}, {Cb0, te},
   Weights -> (1/#3 &)]

but this does not contain a Va or Vb. This cannot work. This is why in your file you get error messages like:

Part::partd: Part specification $Failed[[1]] is longer than depth of object. >> NonlinearModelFit::wtsnn: One or more weight values are not non-negative numbers. Weight values must be non-negative. >>

The fix is in the reply to your last post. Also I am not sure what you want to plot at the end. As Peter Fleck said, Plot[ListPlot ...] does not work. I suppose that you want to plot something like

Show[ListPlot3D[Dataimp], Plot3D[fit1[Cb0, te], {Cb0, 0, 30}, {te, 0, 45}]]

In the attached notebook, I have again (!) added Va and Vb just like the last time when you asked. The fit now (just like last time) fits a function, but it does not meet the criteria for the tolerances/precision and it also needs to use extrapolation. This is why you still get many error messages. Also because I fixed Va and Vb, the fit is not really good at all. It does, however, plot the two functions.

Cheers, Marco

Attachments:
POSTED BY: Marco Thiel
Posted 11 years ago
POSTED BY: Peter Fleck
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard