"John D'Errico" <woodchips@rochester.rr.com> wrote in message <h74ug2$4hr$1@fred.mathworks.com>...
> "Syed Galib" <galib.cse@gmail.com> wrote in message <h74tce$rfb$1@fred.mathworks.com>...
> > "John D'Errico" <woodchips@rochester.rr.com> wrote in message <h74sk3$96d$1@fred.mathworks.com>...
> > > "Syed Galib" <galib.cse@gmail.com> wrote in message <h74r3t$443$1@fred.mathworks.com>...
> > > > Hello,
> > > >
> > > > Is there any method to plot some vpi numbers? Please, inform me if anybody knows anything about this.
> > > >
> > > > Thanks.
> > > >
> > > > Regards
> > > > Galib
> > >
> > > Hmm. plot in what way? I'd never really thought of
> > > plotting them.
> > >
> > > Since they will in general be huge, it might be best to
> > > plot the logs anyway. Since I've implemented the log
> > > of a vpi number, which results in a double, this will be
> > > easy. Of course, if the numbers are small enough to
> > > let them be represented as doubles, then double will
> > > suffice to let them be plotted.
> > >
> > > Let me know if there is something I've missed here, or
> > > that I can provide. I'll be happy to do so if I can.
> > >
> > > And, of course, if you come up with a neat way to do
> > > something, there are now a few others who have
> > > submitted addons to the vpi tools to the FEX, and
> > > one person just sent me a tool to add to the toolbox
> > > directly.
> > >
> > > John
> >
> > Hi John,
> >
> > Thanks for your reply. I was just thinking of plotting the numbers. But as you suggested, I'll try with the log first. But I think, it'd be good for me to plot the numbers directly which is, I think, a tough thing to do. If you have anything then please inform me.
> >
> > Thanks again.
> >
> > Regards
> > Galib
>
> You can convert them to doubles. This will work for up to
> the limit of a double. And since you are plotting them,
> the loss of precision is meaningless.
>
> realmax
> ans =
> 1.79769313486232e+308
>
> X = randint(vpi(10)^300,[10,1]);
> double(X)
> ans =
> 5.88258675757761e+299
> 1.11661968748743e+299
> 8.34449222147048e+299
> 8.98864325038768e+299
> 6.57886636160671e+299
> 3.11417544460711e+299
> 2.17521364980225e+299
> 6.12341103728287e+299
> 5.828722736619e+299
> 8.18930536981494e+299
> plot(double(X))
>
> This works. Had I gone past realmax of course, it
> must fail since the conversion to double runs out
> of room.
>
> I suppose I could overload plot though. Pull out
> the exponent, normalize the numbers, then call
> then call plot myself with the scaled numbers as
> doubles. Then add the exponent as a scale factor
> as plot does now. Something to think about for
> the next release...
>
> Easier to plot the logs, base 10. ;)
>
> John
Dear John,
Thanks for your advice. I am trying to do that. If I get into any problem, I'll ask you again.
Thanks again.
Galib
