How can I set the precision of a numeric object?

조회 수: 2 (최근 30일)
Sai Kumar Dwivedi
Sai Kumar Dwivedi 2015년 3월 16일
댓글: Sai Kumar Dwivedi 2015년 3월 16일
I am using neural network. I want my inputs be of 8 bits precise. I used vpa(x,d) function to set the precision. But it changed the variable x into sym type and when I used double() function to convert sym object to numeric object, it reverted back to original precision.

채택된 답변

John D'Errico
John D'Errico 2015년 3월 16일
Well, it is good to want something. It gives you a goal. You can't always get what you want.
However, software does what it is designed to do, not what you might hope it would do. Tools like VPA are designed to work with symbolic objects, and only that. Other tools in MATLAB will not employ that limited precision. In fact, since most people have various toolboxes, but NOT all of them, it makes no sense for a toolbox to assume that any specific other toolbox will be installed. (There is at least one of exception to this rule, where certain combinations of toolboxes go together.) So the neural net toolbox would never have been written to assume that VPA exists on any given installation.
At best you can have single and double precision variables in MATLAB for general use, and not every tool even enables the use of single.
It seems that your goal is to limit the accuracy of a result, thus setting a tolerance on how well the fit is accomplished. That you should be able to do in the neural net tools.
  댓글 수: 1
Sai Kumar Dwivedi
Sai Kumar Dwivedi 2015년 3월 16일
Thank you so much for your response. I want to set precision, because I am implementing neural network modeled in Matlab on FPGA chip which has a constraint on the number of bits in multiplier. SO I was thinking if I could find the minimum number of bits of both input and weight which would not seriously affect the performance, I could use more chip area. Is there any way I can limit the precision of the variables in Matlab?

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Assumptions에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by