Solve my problem puzzled me for a long time, because I can't print *.jpeg files as the figures, and I used to copy *.fig files to another Windows computer to finish printing wanted picutres.
When I get this function, Matlab under Linux is becoming more amazing!
Thank you very much!
06 Mar 2014
Exports figures nicely to a number of vector & bitmap formats.
It looks like you have a few misunderstandings. What you need to appreciate is how MATLAB works with numbers as an interpreted language. Also how assignments work when there are different classes involved.
First of all, when you do something like this...
V = fun(1 + 2.3);
Here MATLAB performs the operation 1 + 2.3, as a double. The result will be 3.3 (approximately), but it WILL be a double. Then that result is passed into the function fun. Here fun could be ANY function, including a call to HPF, to create an HPF number.
The same holds true for something like...
V = hpf(1.4);
MATLAB FIRST takes the number 1.4. It stores that as a double. Note that 1.4 is NOT exactly storable as a double. In fact, the representation of 1.4 in MATLAB is...
X = hpf(1.4)
Remember that numbers are stored in binary form in MATLAB. So if you really wanted 1.4, you needed to do it like this
X = hpf('1.4')
Here X is EXACTLY 1.4, stored in a decimal form inside HPF.
The same thing applied when you do an operation like
1.4 + hpf(1)
Here 1 is an integer, so HPF is capable of storing that exact value as an HPF version of the integer 1. But then adding 1.4 to that number, remember that MATLAB is an interpreted language. So again, MATLAB has a problem, because MATLAB sees the 1.4 as a DOUBLE number, only then does it realize that it must add that number to an HPF number.
1.4 + hpf(1)
So this does work properly:
hpf('1.4') + 1
2.4 is indeed the exact representation internally.
Next, you have another issue because IF the variable E exists already as a double. See what happens here:
E = zeros(1,2);
E(1) = hpf('1.4')
Name Size Bytes Class Attributes
E 1x2 16 double
E is a double. It is NOT an HPF number. In fact, E is not represented as exactly 1.4. So if I look at the value stored for E, again, it is the wrong number, not exactly the true decimal 1.4. Since E existed already, and you chose to insert the HPF value into the first element of E, MATLAB decided to convert it BACK into a double.
HPF element: (1,1)
In your last example, I don't know what you did. My guess is you were confused, and do not really have what you showed me.
Again, you must be careful about what MATLAB does to the numbers you are working with. And these are things totally beyond my control in the design of HPF. Remember that MATLAB is a language like any other programming language (but unlike what we see in the movies.) It has strict rules about how it will operate on what you pass it, and it cannot know that what you wanted it to do is not what you told it to do.