Message Boards Message Boards

0
|
3128 Views
|
1 Reply
|
0 Total Likes
View groups...
Share
Share this post:

Benzeir curve problem

Posted 9 years ago

I cant to get the curve from below code, is there any mistakes from below codes ? thanks

r0 = {0.9, 0.8333}; r1 = {0.8722, 0.8111}; r2 = {0.8528, 0.7667}; r3 = {0.8472, 0.7167}; r4 = {0.8583, 0.6667}; r5 = {0.8861, 0.6194}; r6 = {0.9167,0.5806}; r7 = {0.9639, 0.5528}; r8 = {1.008, 0.5361}; r9 = {1.075, 0.5333};

n = 9; b[i, n, t_] := Binomial[n, i] t^i (1 - t)^(n - i); B1[t_] := Sum[b[i, n, t] ri, {i, 0, 9}]; R = ListPlot[{r0, r1, r2, r3, r4, r5, r6, r7, r8, r9}, Joined -> True, PlotStyle -> {Orange, Dashed}, PlotRange -> Automatic, AspectRatio -> Automatic]; Show[ R, ParametricPlot[B1[t], {t, 0, 1}, PlotStyle -> Cyan, PlotRange -> Automatic, AspectRatio -> Automatic], PlotRange -> Automatic]

POSTED BY: Ng Ling
Posted 9 years ago

There seem to be several misunderstandings and mistakes in your code.

r = {{0.9, 0.8333}, {0.8722, 0.8111}, {0.8528, 0.7667}, {0.8472, 0.7167}, {0.8583, 0.6667},
     {0.8861, 0.6194}, {0.9167, 0.5806}, {0.9639, 0.5528}, {1.008, 0.5361}, {1.075, 0.5333}};
n = 10;
b[i_, n_, t_] := Binomial[n, i] t^i (1 - t)^(n - i); 
B1[t_] := Sum[b[i, n, t] r[[i]], {i, 1, 10}];
R = ListPlot[r, Joined->True, PlotStyle->{Orange, Dashed}, PlotRange->Automatic, AspectRatio->Automatic];
Show[R, ParametricPlot[B1[t], {t, 0, 1}, PlotStyle->Cyan, PlotRange->Automatic, AspectRatio->Automatic], 
  PlotRange->Automatic]

Overlaid Plots

Please compare my code with yours character by character looking for any tiny changes. When you find the changes then look in the documentation for Mathematica and try to understand why I would make such a change.

Even with my changes there are still problems with the first data points. I may have made mistakes or misunderstood. If you find that I have made a mistake and you can explain this then I will try to fix my error. Or it is possible that the data points need to be used in a different way.

POSTED BY: Bill Simpson
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