f



Differences in Digits in Matlab

I posted a thread over at...... http://www.mathworks.com/matlabcentral/newsreader/view_thread/257642#670417...... regarding differences in digits between Maple and Matlab which still has not been fully addressed....

However, the problem I observe is also seen in just Matlab on it's own.... The behavior has to do with the sym object class. (I am using the Maple toolbox for matlab and Matlab R 2009 A 64 bit)

As an example

>> digits(30)
>> vpa(sym('pi'))*.1
 
ans =
 
                       0.314159265358979342695820259867
>> vpa(sym('pi'))*(.9-.8)
 
ans =
 
                       0.314159265358979254731225959353

Both of the above are being multiplied by the same number .1 however the case where (.9-.8) is instead being multiplied yields a different result.....

Could anyone please shed some light on this for me.... Thanks.
0
omegayen (84)
8/5/2009 3:16:01 AM
comp.soft-sys.matlab 211264 articles. 26 followers. lunamoonmoon (257) is leader. Post Follow

10 Replies
691 Views

Similar Articles

[PageSpeed] 32

omegayen  <omegayen@ameritech.net> wrote:
>>> vpa(sym('pi'))*.1
> 
> ans =
> 
>                       0.314159265358979342695820259867
>>> vpa(sym('pi'))*(.9-.8)
> 
> ans =
> 
>                       0.314159265358979254731225959353
> 
> Both of the above are being multiplied by the same number .1 however 
> the case where (.9-.8) is instead being multiplied yields a different 
> result.....

Seems like this is showing up almost daily lately.

The above are NOT being multiplied by the same number.
Binary computers have limited resolution so ( for instance)
1+1+1 is not necessarily the same as 2+1. Thats just the way
it is in any language ( Matlab included) on any digital computer.

Check any of the other similar threads on this topic or
look up IEE 64-bit floating point math.

Short story: with 64-bit math one gets about 15 significant
figures and that's it. Anything approaching this limit will
see the noise that digital qunatization creates.

Fortunately almost nothing in the real world need 15
significant figures, so std double precision is good enough
for most purposes.

Stan
0
stan6508 (159)
8/5/2009 3:34:40 AM
>>isequal(.9-.8,.1)
ans =
     0

Hmmm......
0
spamanon (2437)
8/5/2009 3:55:03 AM
On Aug 5, 3:16=A0pm, "omegayen " <omega...@ameritech.net> wrote:
> I posted a thread over at......http://www.mathworks.com/matlabcentral/new=
sreader/view_thread/257642#......... regarding differences in digits betwee=
n Maple and Matlab which still has not been fully addressed....
>
> However, the problem I observe is also seen in just Matlab on it's own...=
.. The behavior has to do with the sym object class. (I am using the Maple t=
oolbox for matlab and Matlab R 2009 A 64 bit)
>
> As an example
>
> >> digits(30)
> >> vpa(sym('pi'))*.1
>
> ans =3D
>
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A00.314159265358979342695820=
259867
>
> >> vpa(sym('pi'))*(.9-.8)
>
> ans =3D
>
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A00.314159265358979254731225=
959353
>
> Both of the above are being multiplied by the same number .1 however the =
case where (.9-.8) is instead being multiplied yields a different result...=
...
>
> Could anyone please shed some light on this for me.... Thanks.

By Golly, you're right!!
There is a definite discrepancy between these two answers at the
thirteenth place.
I think you deserve a Nobel Prize for this earth-shattering discovery!
Honestly, how can one do any decent calculations when you have to use
crappy software that gives such inaccurate answers.
Please continue to pursue this promising avenue of your research.
Meanwhile, the rest of us will struggle on regardless, desperately
awaiting your developments.
When you solve the problem, please get back to us on this forum ASAP.
However, I fear that you have embarked upon an avenue that will take a
lifetime.

Best Wishes
0
mulgor (3008)
8/5/2009 4:09:14 AM
Stan Bischof <stan@newserve.worldbadminton.com> wrote in message <4a78fdd0$0$1612$742ec2ed@news.sonic.net>...
> 
> Binary computers have limited resolution so ( for instance)
> 1+1+1 is not necessarily the same as 2+1.

Good point, bad example. 1 *can* be represented exactly in every floating point scheme I am aware of, and so can the 2, 1+1+1, and 2+1. So you will always get exactly the same result for these particular cases.

James Tursa
0
8/5/2009 4:17:03 AM
"omegayen " <omegayen@ameritech.net> wrote in message <h5athh$2qa$1@fred.mathworks.com>...
> I posted a thread over at...... http://www.mathworks.com/matlabcentral/newsreader/view_thread/257642#670417...... regarding differences in digits between Maple and Matlab which still has not been fully addressed....
> 
> However, the problem I observe is also seen in just Matlab on it's own.... The behavior has to do with the sym object class. (I am using the Maple toolbox for matlab and Matlab R 2009 A 64 bit)
> 
> As an example
> 
> >> digits(30)
> >> vpa(sym('pi'))*.1
>  
> ans =
>  
>                        0.314159265358979342695820259867
> >> vpa(sym('pi'))*(.9-.8)
>  
> ans =
>  
>                        0.314159265358979254731225959353
> 
> Both of the above are being multiplied by the same number .1 however the case where (.9-.8) is instead being multiplied yields a different result.....
> 
> Could anyone please shed some light on this for me.... Thanks.

I thought I answered this last night.

Try this in MATLAB:

(.9-.8) == 0.1
ans = 
       0

They are not the same. 0.1 is only accurate to roughly
16 decimal digits. Even multiplying it by a symbolic
pi, 0.1 is still crap past the 15th digit. And (0.9 - 0.8)
is different crap.

Read the FAQ.

John
0
woodchips (7944)
8/5/2009 8:21:02 AM
"omegayen "
> >> digits(30)
> >> vpa(sym('pi'))*.1
> ans =0.314159265358979342695820259867
> >> vpa(sym('pi'))*(.9-.8)
> ans =0.314159265358979254731225959353
> Both of the above are being multiplied by the same number .1 however the case where (.9-.8) is instead being multiplied yields a different result.....
> Could anyone please shed some light on this for me.... Thanks.

firstly, others have shed all the light on this...

HOWEVER, just a word of caution...
things are different if you use the mupad kernel: r2009a/symbolic math tbx 5.2...

     od=digits;
     digits(30);
     spi=sym('pi');
     r=[
          vpa(spi)*.1
          .1*vpa(spi)
          vpa(spi)*(.9-.8)
          (.9-.8)*vpa(spi)
     ];
     disp(vpa(spi));
%    3.14159265358979323846264338328
     disp(r);
%{
     0.314159265358979323846264338328
     0.314159265358979323846264338328
     0.314159265358979323846264338328
     0.314159265358979323846264338328
%}
     disp(diff(double(r)));
%{
     0
     0
     0
%}
     digits(od);

it seems that the new approach by default converts every var into a SYM BEFORE calculation once it encounters a SYM in the command...

us
0
us1 (8051)
8/5/2009 8:52:01 AM
"us " <us@neurol.unizh.ch> wrote in message <h5bh7h$loo$1@fred.mathworks.com>...
> "omegayen "
> > >> digits(30)
> > >> vpa(sym('pi'))*.1
> > ans =0.314159265358979342695820259867
> > >> vpa(sym('pi'))*(.9-.8)
> > ans =0.314159265358979254731225959353
> > Both of the above are being multiplied by the same number .1 however the case where (.9-.8) is instead being multiplied yields a different result.....
> > Could anyone please shed some light on this for me.... Thanks.
> 
> firstly, others have shed all the light on this...
> 
> HOWEVER, just a word of caution...
> things are different if you use the mupad kernel: r2009a/symbolic math tbx 5.2...
> 
>      od=digits;
>      digits(30);
>      spi=sym('pi');
>      r=[
>           vpa(spi)*.1
>           .1*vpa(spi)
>           vpa(spi)*(.9-.8)
>           (.9-.8)*vpa(spi)
>      ];
>      disp(vpa(spi));
> %    3.14159265358979323846264338328
>      disp(r);
> %{
>      0.314159265358979323846264338328
>      0.314159265358979323846264338328
>      0.314159265358979323846264338328
>      0.314159265358979323846264338328
> %}
>      disp(diff(double(r)));
> %{
>      0
>      0
>      0
> %}
>      digits(od);
> 
> it seems that the new approach by default converts every var into a SYM BEFORE calculation once it encounters a SYM in the command...
> 
>us

This seems to have been the default behavior also in R2008a and b:

>> digits(30)
>> isequal(vpa(sym('pi'))*(.9-.8),vpa(sym('pi'))*.1)

ans =

     1

Furthermore,
>> isequal(vpa(pi)*(.9-.8),vpa(pi)*.1)

ans =

     1

>> isequal(vpa(.9-.8),vpa(.1))

ans =

     1

So it seems "vpa" has (had) the same effect as "sym" 


The original problem on R2008b gives 

>> vpa(sym('pi'))*.1
 
ans =
 
0.314159265358979323846264338328
 
>> vpa(sym('pi'))*(.9-.8)
 
ans =
 
0.314159265358979323846264338328

Finally, according to Matlab's documentation on sym (and also vpa):

    "Statements like pi = sym('pi') and delta = sym('1/10') create symbolic
    numbers which avoid the floating point approximations inherent in the
     values of pi and 1/10."

So it seems that using   vpa(sym('pi'))*vpa(sym('1/10') or  vpa('pi')*vpa('1/10') should be preferable in general.

K.H.
0
8/5/2009 10:38:02 AM
"Khaled Hamed" 
> "us "
> > HOWEVER, just a word of caution...
> > things are different if you use the mupad kernel: r2009a/symbolic math tbx 5.2...
> > it seems that the new approach by default converts every var into a SYM BEFORE calculation once it encounters a SYM in the command...

> This seems to have been the default behavior also in R2008a and b:

yes, because the mupad engine was introduced in r2007b

http://www.mathworks.com/access/helpdesk/help/toolbox/symbolic/rn/brqy13y-1.html

us
0
us1 (8051)
8/5/2009 10:47:01 AM
"us " <us@neurol.unizh.ch> wrote in message <h5bnv5$ji7$1@fred.mathworks.com>...
> "Khaled Hamed" 
> > "us "
> > > HOWEVER, just a word of caution...
> > > things are different if you use the mupad kernel: r2009a/symbolic math tbx 5.2...
> > > it seems that the new approach by default converts every var into a SYM BEFORE calculation once it encounters a SYM in the command...
> 
> > This seems to have been the default behavior also in R2008a and b:
> 
> yes, because the mupad engine was introduced in r2007b
> 
> http://www.mathworks.com/access/helpdesk/help/toolbox/symbolic/rn/brqy13y-1.html
> 
> us

I appreciate all the help guys. It is quite clear now... Final results are illustrated below using matlab 2009 R A.

using maple toolbox for matlab (maple 13)

digits(30)
>> vpa(sym('pi'))*.1
 
ans =
 
0.314159265358979336412634952687

>> vpa(sym('pi'))*(.9-.8)
 
ans =
 
0.314159265358979248448040652173

>>vpa(sym('pi'))*vpa(sym('1/10'))
 
ans =
 
0.314159265358979323846264338328



using symbolic math toolbox 5.2  (switch by means of environmental variables)
digits(30)
>> vpa(sym('pi'))*.1
 
ans =
 
0.314159265358979323846264338328
 
>> vpa(sym('pi'))*(.9-.8)
 
ans =
 
0.314159265358979323846264338328
0
omegayen (84)
8/5/2009 5:49:01 PM
"omegayen " <omegayen@ameritech.net> wrote in message <h5cgmd$hqi$1@fred.mathworks.com>...
> "us " <us@neurol.unizh.ch> wrote in message <h5bnv5$ji7$1@fred.mathworks.com>...
> > "Khaled Hamed" 
> > > "us "
> > > > HOWEVER, just a word of caution...
> > > > things are different if you use the mupad kernel: r2009a/symbolic math tbx 5.2...
> > > > it seems that the new approach by default converts every var into a SYM BEFORE calculation once it encounters a SYM in the command...
> > 
> > > This seems to have been the default behavior also in R2008a and b:
> > 
> > yes, because the mupad engine was introduced in r2007b
> > 
> > http://www.mathworks.com/access/helpdesk/help/toolbox/symbolic/rn/brqy13y-1.html
> > 
> > us
> 
> I appreciate all the help guys. It is quite clear now... Final results are illustrated below using matlab 2009 R A.
> 
> using maple toolbox for matlab (maple 13)
> 
> digits(30)
> >> vpa(sym('pi'))*.1
>  
> ans =
>  
> 0.314159265358979336412634952687
> 
> >> vpa(sym('pi'))*(.9-.8)
>  
> ans =
>  
> 0.314159265358979248448040652173
> 
> >>vpa(sym('pi'))*vpa(sym('1/10'))
>  
> ans =
>  
> 0.314159265358979323846264338328
> 
> 
> 
> using symbolic math toolbox 5.2  (switch by means of environmental variables)
> digits(30)
> >> vpa(sym('pi'))*.1
>  
> ans =
>  
> 0.314159265358979323846264338328
>  
> >> vpa(sym('pi'))*(.9-.8)
>  
> ans =
>  
> 0.314159265358979323846264338328


NOTE, I had to use the 32 bit version of Matlab in order to do this as the 64 bit version does not support the symbolic math toolbox :(
0
omegayen (84)
8/5/2009 6:45:21 PM
Reply:

Similar Artilces:

different results in function regress from MATLAB 6.5 to MATLAB 7.0
Hello , anybody knows when I execute the function "regress" to this model (STAR(1)) Yt = 1 - 0-5Yt-1 - (4 + 0.4Yt-1)G(gamma*Yt-1) + et, where G(z) =1/ [1 + exp(-z)], gamma=4; et=N(0,1) I obtain different radically different results from matlab 6.5 to matlab 7.0 that with other models??Any suggestion to avoid this problem??? On May 25, 4:40=A0am, "Kun Aguero" <isildur20022...@yahoo.es> wrote: > Hello , anybody knows when I execute the function "regress" to this model= (STAR(1)) > Yt =3D 1 - 0-5Yt-1 - (4 + 0.4Yt-1)G(gamma*Yt-1) + et, where G(z) =3D1/ [1= + exp(-z)], > gamma=3D4; > > et=3DN(0,1) > I obtain different radically different results from matlab 6.5 to matlab = 7.0 that with other models??Any suggestion to avoid this problem??? Please show the relevant code. Hope this helps. Greg Well,I have made several tests and this is the result: -When I use the function regress in this format in matlab 6.5, it works: [B1,BINT1,R_X,RINT1,STATS1]=regress(X(2:length(X))',[ones(length(X)-1,1),X(1:length(X)-1)']); -When I use the same format in matlab 7.0 it doesn't works, but if I use this format: [B1,BINT1,R_X,RINT1,STATS1]=regress(X(2:length(X))',X(1:length(X)-1)'); It works in matlab 7.0. Then I think the problem is how the function regress treats the independent term in both versions?? regards Greg Heath <heath@alumni.brown.edu> wrote in message <69879944-34b7-4262-a193-0bb545d8cf99@...

Spawning matlab from within matlab
Hello all, I would like to spawn multiple matlab processes from an '.m' script. Meaning, run an m-file from a 'parent' Matlab that launches, say, 8 more 'children' matlab processes. I'd like to do it in such a way that the same m-file in the 'parent' is able to close down, or kill, all the 'children' processes. Any suggestions? Joe ...

Matlab engine with matlab R2010b
Hello All, I'm working with an aplication that use the matlab engine. I made the C++ program and it is working well in my pc with matlab 2007b, but the same very basic program shows an error when I tried to compile it in a pc with matlab R2010b. The error is about the icuuc32.dll. ¿Why is asking this DLL? How can I solve this?. Thanks¡ ...

how to digitize in matlab
I am new to using matlab 2007a version . I am looking to digitize maps in matlab. I downloaded the Digitize.m file from the site.kindly tell me that What i will do with this file and where will i save this matfile in matlab and how to use this tool. ...

embedded matlab function MATLAB R2009a
I downloaded the MS visual C++ 2008 Express Edition and the SDK as detailed in http://www.mathworks.com/support/solutions/en/data/1-6IJJ3L/?solution=1-6IJJ3L My embedded function didnt work at the beginning because I did "mex -setup" before I installed my SDK. But after I installed the SDK, I ran "mex -setup" in Matlab once again and choose the MS visual C++2008 as my compiler. Then, my embedded matlab function worked. Thanks to the contribution from above! ...

Creating DLL in Matlab and using them in Matlab?
Hi, is it possible to create dll in Matlab and then using it in other Matlab apllication? I've made a simple function and put it into dll. But when I try to use this library in other apllication written in matlab it doesn't works. Any idea? -- Pozdrawiam, e-Shrek hi e-shresk, I once created a matlab dll, and called it in c code. it worked. I guess you have to check whether you dll was built correctly or not. ps. why don't u call matlab function directly? Dnia Mon, 26 Oct 2009 07:19:04 +0000 (UTC), Jun napisa�(a): > hi e-shresk, > > I once created a matlab dll, and called it in c code. it worked. Hmmm. The function is very simple: ========================== function var_o = testlib(var_i) if var_i == '1', var_o = 'jest'; else var_o = 'brak'; end ========================== Compilation: mcc -W lib:xlib -T link:lib testlib After it, I have *.dll *.lib *.h Tryin' to load library: loadlibrary('xlib.dll','xlib.h'); The result is: Warning: Warnings messages were produced while parsing. Check the functions you intend to use for correctness. Warning text can be viewed using: [notfound,warnings]=loadlibrary(...) > In loadlibrary at 394 Where is the problem? > ps. why don't u call matlab function directly? I have a pack of functions that I wouldlike to use with few different matlab compiled programs. -- Pozdrawiam, e-Shrek On Oct 26, 1:47=A0pm, e-Shrek <e-Shrek.wyt...@wytni...

Matlab parallel for loop or Matlab open pool
I am trying to to some computations and I would like to do it in parallel using parfor or by Opening the matlabpool.. as the current implementations is too slow: result=zeros(25,16000); for i = 1:length(vector1) % length is 25 for j = 1:length(vector2) % length is 16000 temp1 = vector1(i); temp2 = vector2(j); t1 = load(matfiles1(temp1).name) %load image1 from matfile1 t2 = load(matfiles2(temp2).name) % load image2 from matfile2 result(i,j)=t1.*t2 end end It work fine but I would really like to know if there is a way to speed thing up ... Thanks a lot in advance! ...

Matlab 2011: matlab coder (build failed)
When I create a MATLAB Coder Project and try to convert this function: ------------------------- function y = myResampler(x,m,n) %#codegen fsVec = [8000 16000 32000 48000]; targetFsVec = [8000 16000 32000 48000]; fs = fsVec(m); targetFs = targetFsVec(n); y = resample(x,targetFs,fs); ------------------------- to C-code I get a build error saying: coder -build resamplerproj.prj ??? The upsample factor P must be constant. Error in ==> myResampler Line: 12 Column: 5 Code generation failed: Open error report. But I want to be able to resample x using a variable P/Q ratio. Is this just a limitation of Matlab Coder or am I doing something wrong?? John wrote: > When I create a MATLAB Coder Project and try to convert this function: > > ------------------------- > function y = myResampler(x,m,n) %#codegen > > fsVec = [8000 16000 32000 48000]; > targetFsVec = [8000 16000 32000 48000]; > > fs = fsVec(m); > targetFs = targetFsVec(n); > > y = resample(x,targetFs,fs); > ------------------------- > > to C-code I get a build error saying: > > coder -build resamplerproj.prj ??? The upsample factor P must be > constant. Error in ==> myResampler Line: 12 Column: 5 Code generation > failed: Open error report. > > > > But I want to be able to resample x using a variable P/Q ratio. > > Is this just a limitation of Matlab Coder or am I doing something wrong?? Apparently it's a limitation of RESAMPLE ...

code of matlab 7a not working in matlab 2009
I wrote a code in matlab 7a andand it was working over there then i changed computer which was having matlab realease 2009a and it is not working If i install Matlab 7 release 14, will my code work again thanks "moonman" wrote in message <ipmsl7$23v$1@fred.mathworks.com>... > I wrote a code in matlab 7a andand it was working over there > then i changed computer which was having matlab realease 2009a and it is not working > > If i install Matlab 7 release 14, will my code work again thanks Can you be more specific about the fact that your code is not working in 2009a but worked in 2007a? It would be helpful if you could narrow down what is not working in 2009a and provide error messages. Wayne ok thanks wyne i will send error message after some hours ...

Debugging matlab with emacs and avoiding matlab editor
I am using matlab mode in emacs to run matlab without using any of the matlab buildt in GUI. However, when I use debugging eg. "dbstop error" the matlab editor opens. Does anyone know how to avoid this? -- Associate Prof. Ph.D Torben Knudsen Mobile : (+45) 2787 9826 Section of Automation and Control, Direct : 6 8694 Department of Electronic Systems, Email : tk@es.aau.dk Aalborg University Fredrik Bajersvej 7 DK-9220 Aalborg � Denmark On 10 Sep, 13:48, Torben Knudsen <t...@es.aau.dk> wrote: > I am using matlab mode in emacs to run matlab without using any of the > matlab buildt in GUI. =A0However, when I use debugging eg. "dbstop > error" the matlab editor opens. =A0Does anyone know how to avoid this? Don't know how to help, but this reminds me of moving from matlab 4 to matlab 5 on HP-UX aeons ago. As I remember, matlab 5 was the first version based on the matlab GUI, and that particular feature, that the editor appeared in debug mode, was really annoying. Almost put me off matlab alltogether. Haven't seen or heard about anybody working matlab like that for the past, what, 12-15 years? Just out of curiosity, what version of matlab (and emacs) do you use? Rune Rune Allnor <allnor@tele.ntnu.no> writes: > On 10 Sep, 13:48, Torben Knudsen <t...@es.aau.dk> wrote: >> I am using matlab mode in emacs to run matlab without using any of the >> matlab buildt in GUI. �However, when I use debugging eg. &q...

Contribute to MATLAB Central and Win a MATLAB Jacket
Many of you who post to this newsgroup are also regular contributors to the MATLAB Central File Exchange. Look for your favorite contributors on our File Exchange Author Profile page. You can read their profiles and see pictures: <http://www.mathworks.com/matlabcentral/reports/fileexchange/allProfiles/> In a random drawing, we recently awarded MATLAB jackets to three File Exchange authors with profile pages: Michele Giugliano, Andrey Egin, and Denis Gilbert. You can win a jacket, too. Just submit a new file to the File Exchange or update your author profile by December 2003 for a chance to win one of four MATLAB jackets. See the jacket below: <http://www.mathworks.com/matlabcentral/images/jeff3.jpg> Here are some interesting File Exchange facts: - Since its inception in 2001, visitors have downloaded more than 1.25 million submissions from the File Exchange. - In September 2003 alone, visitors downloaded 80,085 files, an average of 2670 a day! .... what if the prize was a free copy of the next version of Matlab :-) majb Min Poh wrote: ....or an offer for employment... aj "bourassa" <bourassa-m@rmc.ca> wrote in message news:3f9d507d$1@rmcnt03a.rmc.ca... > ... what if the prize was a free copy of the next version of Matlab :-) > > majb > > Min Poh wrote: > ...

creating GUI in matlab out of some programs written in matlab
I have written some code in matlab for my application. I want to make a graphical interface so that an user can easily use my code. I do not know, how to link my code or a particular function when user clicks on a particular button. I mean, how to assign a function written by me to a push button so that it will execute the function. And how to give the input to my function and get output after executing the particular function. I am quiet familiar with matlab code. But I am absolutely new with GUI in matlab. Please help me to deal with the above problem. On 4/12/2011 12:37 AM, sk maidul haque wrote: > I have written some code in matlab for my application. > I want to make a graphical interface so that an user can easily use my code. > I do not know, how to link my code or a particular function > when user clicks on a particular button. I mean, how to assign a > function written by me to a push button so that it will execute the function. > And how to give the input to my function and get output after > executing the particular function. > I am quiet familiar with matlab code. But I am absolutely new with > GUI in matlab. Please help me to deal with the above problem. Use GUIDE to make the gui. It is very simple and powerful to use. I use it all the time for my school projects and HW's. I know some prefer to code the thing by hand, but I prefer GUIDE. When you add a button in GUIDE, it will create a callback stub for you automatically...

how to do this in matlab
Number of column: 5 Vector A: [ 2 4 6 7 8 ] Vector B : [ 5 7 8 10 1] Choice = 1 : Find the highest value Vector A : 8 Vector B: 10 The highest value : 10 Choice = 2 : Find the lowest value Vector A : 2 Vector B: 1 The highest value : 1 Choice = 3 : Find the average value of : Vector A Vector B "Syamil " <syamilsaid@gmail.com> wrote in message <inq3g8$hhd$1@fred.mathworks.com>... > Number of column: 5 > Vector A: [ 2 4 6 7 8 ] > Vector B : [ 5 7 8 10 1] > > Choice = 1 : Find the highest value > Vector A : 8 > Vector B: 10 > The highest value : 10 > > Choice = 2 : Find the lowest value > Vector A : 2 > Vector B: 1 > The highest value : 1 > > Choice = 3 : Find the average value of : > Vector A > Vector B Type in matlab: doc min doc max doc mean ...

Why does Matlab do this
What is happening when I type rand(1:10) at the command line? Matlab goes into a 10 minute spin - what's going on? Thanks "Robert" wrote in message <j64asi$5v4$1@newscl01ah.mathworks.com>... > What is happening when I type > rand(1:10) > at the command line? > > Matlab goes into a 10 minute spin - what's going on? > Thanks Hi Robert, You're create a 10-D array with that syntax. Do you just want a vector of 10 uniformly distributed random numbers. x = rand(10,1); % or x = rand(1,10); Wayne Hi Wayne, You're right - that's what I was trying to do... but I was just newbie mucking about trying to work out the syntax and I typed that in - then had a looong wait for Matlab to work through it! Thanks for the explanation. Robert "Robert" wrote in message <j64d2h$dvo$1@newscl01ah.mathworks.com>... > Hi Wayne, > You're right - that's what I was trying to do... but I was just newbie mucking about trying to work out the syntax and I typed that in - then had a looong wait for Matlab to work through it! > Thanks for the explanation. > Robert That's fine. Welcome to MATLAB!!! If that's the worst memory-intensive mistake you ever make, you'll be fine :) I've done much, much worse. Wayne ...

Problems calling from Matlab a Matlab compiled dll
Hi, I'm trying to make a dll from an m-file and use the dll function calling from the workspace or from an m file using 2008A version: Step 1 function [output] = addizione (a,b) output = a+b; end Step 2 I compile it with matlab compiler mcc -l addizione I obtain addizione.dll, .lib, .h etc Step 3 load the newly created addizione.dll loadlibrary ('addizione','addizione') with the following warnings: Type 'LARGE_INTEGERPtr' was not found. Defaulting to type voidPtr. Found on line 20522 of input from line 7673 of file C:\Programmi\MATLAB\R2008a\sys\lcc\include\win.h Type '_TREEITEMPtr' was not found. Defaulting to type voidPtr. Found on line 20944 of input from line 8095 of file C:\Programmi\MATLAB\R2008a\sys\lcc\include\win.h Type 'PROPSHEETPAGEPtr' was not found. Defaulting to type voidPtr. Found on line 21328 of input from line 8479 of file C:\Programmi\MATLAB\R2008a\sys\lcc\include\win.h Type '_PSPPtr' was not found. Defaulting to type voidPtr. Found on line 21329 of input from line 8480 of file C:\Programmi\MATLAB\R2008a\sys\lcc\include\win.h Type 'PROPSHEETHEADERPtr' was not found. Defaulting to type voidPtr. Found on line 21351 of input from line 8502 of file C:\Programmi\MATLAB\R2008a\sys\lcc\include\win.h Type 'LARGE_INTEGER' was not found. Defaulting to type error. Found on line 21610 of input from line 8761 of file C:\Programmi\MATLAB\R2008a\sys\lcc\include\win.h Type 'L...

matlab difference equation
hi, i need help with the matlab code to solve following difference equation: y(t)?0.5y(t ?1) = ?(t), [for t = 0,1,2,3....] with zero initial condition, where ? is the unit pulse ? = 1 for t = 0, otherwise ? = 0 i'll be grateful if someone could help. thanks :) sorry, there were some symbols missing in the earlier post. Here is the correct problem: y(t)-0.5y(t -1) = delta(t), [for t = 0,1,2,3....] with zero initial condition, where delta is the unit pulse delta = 1 for t = 0, otherwise delta = 0 i'll be grateful if someone could help. thanks :) ...

Need help for a matlab mini project
Hello everyone, I have a matlab in class exercise due in few days. I am new to matlab and the instructions provided with the assignment is minimal. Can Someone help me with the basic understanding as in how can I map the problem's solution to matlab script ? I am not able to post question here as it is a jpeg file. Please let me know and then we can discuss further. ...

Matlab automation server and Matlab Compiler Run Time
I did a simple excel macro which runs matlab functions sucessfully in a machine with Matlab installed. Now I want to run it in a computer without matlab, with "MATLAB Compiler Run Time" installed. I can add the Matlb automation server type file (mlapp.tlb) sucessfully, but when I try to run it, I get this error: "ActiveX component can't create object" In this line: Set matlab = New MLApp.MLApp Do you know what is missing? Thanks ...

Develop web application with Matlab (calling matlab from PHP)
Hi all, I am doing a course project. Try to make phone upload some data to server through PHP script and make Matlab read this file (.txt or any file), process, and write a result file on server. After that, my phone can download the result. The key part is that can I use PHP to call matlab function? Or any mechanism I can use to call Matlab through server-end script? My server will be the local hosted server on Mac computer. Also, Matlab is installed on my mac too. Thanks you very much. On Oct 7, 11:54=A0am, Lucas Sun <feng...@gmail.com> wrote: > Hi all, > > I am doing a course project. Try to make phone upload some data to > server through PHP script and make Matlab read this file (.txt or any > file), process, and write a result file on server. After that, my > phone can download the result. > > The key part is that can I use PHP to call matlab function? Or any > mechanism I can use to call Matlab through server-end script? My > server will be the local hosted server on Mac computer. Also, Matlab > is installed on my mac too. > > Thanks you very much. I m also finding this...... ...

Call Matlab m-file from Matlab Scrip Node
My problem with matlab script node is related to calling function in matlab.&nbsp; I created an m-file function that takes an imput temperature (from DAQ) and defines a material property.&nbsp; My matlab script node doesn't seem to recognize my function.&nbsp; I have placed the function in the folder the vi is currently located, but it doesn't read it.&nbsp; How do I get matlab script node to read the functions I create in matlab? Add the directory to matlab path, or call the .m file with it full name ( D:\..... \myfile.m) Let me clarify, &nbsp; I have pasted my matlab code into the matlab scrip node. &nbsp; In this code, I have called a subfunction that I have created. &nbsp; Example k(n)=k_c(T(n)) where k_c is a subfunction I have created. &nbsp; How do I get my code in the node&nbsp;to sucessfully read the subfunction k_c? &nbsp; &nbsp; &nbsp; As indicated, you need to add the directory where the .m file containing the function resides to the list of paths that are read in. This is your startup.m file. The other option is to do a "cd" command prior to calling your function to change to the directory where the .m file containing the function resides. Thanks for reiterating the information.&nbsp; My matlab script node is working properly.&nbsp; I had never used the "cd" command in matlab.&nbsp; I always set the working directory when I open the program, and put all the m files into t...

MatLab Error Of This program has been modified outside MatLab editor
Hi, I am running a MatLab program I've run many times before, and now when I try to run it, I get a message saying : "This program has been modified outside of the MatLab editor. Do you want to reload it?" I've moved the program to a new directory, but I've run MatLab progs from that directory before, so I am perplexed. Can anyone tell me what to do? TIA, Matt In article <972bbd06-3687-4253-9aa0-a08acf91d117@z38g2000hsc.googlegroups.com>, junoexpress <MTBrenneman@gmail.com> wrote: >I am running a MatLab program I've run many times before, and now when >I try to run it, I get a message saying : >"This program has been modified outside of the MatLab editor. Do you >want to reload it?" >I've moved the program to a new directory, but I've run MatLab progs >from that directory before, so I am perplexed. >Can anyone tell me what to do? Use Save As to save the current version under a different name. Then allow Matlab to reload the file. Save that, and then compare the two saved versions to determine what the differences are, and create an appropriately merged version. -- "There is nothing so bad but it can masquerade as moral." -- Walter Lippmann junoexpress <MTBrenneman@gmail.com> wrote in message <972bbd06-3687-4253-9aa0- a08acf91d117@z38g2000hsc.googlegroups.com>... > Hi, >...

Problems calling from Matlab a Matlab compiled dll #3
Hi, I'm trying to make a dll from an m-file and use the dll function calling from the workspace or from an m file using 2008A version: Step 1 function [output] = addizione (a,b) output = a+b; end Step 2 I compile it with matlab compiler mcc -l addizione I obtain addizione.dll, .lib, .h etc Step 3 load the newly created addizione.dll loadlibrary ('addizione','addizione') with the following warnings: Type 'LARGE_INTEGERPtr' was not found. Defaulting to type voidPtr. Found on line 20522 of input from line 7673 of file C:\Programmi\MATLAB\R2008a\sys\lcc\include\win.h Type '_TREEITEMPtr' was not found. Defaulting to type voidPtr. Found on line 20944 of input from line 8095 of file C:\Programmi\MATLAB\R2008a\sys\lcc\include\win.h Type 'PROPSHEETPAGEPtr' was not found. Defaulting to type voidPtr. Found on line 21328 of input from line 8479 of file C:\Programmi\MATLAB\R2008a\sys\lcc\include\win.h Type '_PSPPtr' was not found. Defaulting to type voidPtr. Found on line 21329 of input from line 8480 of file C:\Programmi\MATLAB\R2008a\sys\lcc\include\win.h Type 'PROPSHEETHEADERPtr' was not found. Defaulting to type voidPtr. Found on line 21351 of input from line 8502 of file C:\Programmi\MATLAB\R2008a\sys\lcc\include\win.h Type 'LARGE_INTEGER' was not found. Defaulting to type error. Found on line 21610 of input from line 8761 of file C:\Programmi\MATLAB\R2008a\sys\lcc\include\win.h Type 'L...

Problems calling from Matlab a Matlab compiled dll #2
Hi, I'm trying to make a dll from an m-file and use the dll function calling from the workspace or from an m file using 2008A version: Step 1 function [output] = addizione (a,b) output = a+b; end Step 2 I compile it with matlab compiler mcc -l addizione I obtain addizione.dll, .lib, .h etc Step 3 load the newly created addizione.dll loadlibrary ('addizione','addizione') with the following warnings: Type 'LARGE_INTEGERPtr' was not found. Defaulting to type voidPtr. Found on line 20522 of input from line 7673 of file C:\Programmi\MATLAB\R2008a\sys\lcc\include\win.h Type '_TREEITEMPtr' was not found. Defaulting to type voidPtr. Found on line 20944 of input from line 8095 of file C:\Programmi\MATLAB\R2008a\sys\lcc\include\win.h Type 'PROPSHEETPAGEPtr' was not found. Defaulting to type voidPtr. Found on line 21328 of input from line 8479 of file C:\Programmi\MATLAB\R2008a\sys\lcc\include\win.h Type '_PSPPtr' was not found. Defaulting to type voidPtr. Found on line 21329 of input from line 8480 of file C:\Programmi\MATLAB\R2008a\sys\lcc\include\win.h Type 'PROPSHEETHEADERPtr' was not found. Defaulting to type voidPtr. Found on line 21351 of input from line 8502 of file C:\Programmi\MATLAB\R2008a\sys\lcc\include\win.h Type 'LARGE_INTEGER' was not found. Defaulting to type error. Found on line 21610 of input from line 8761 of file C:\Programmi\MATLAB\R2008a\sys\lcc\include\win.h Type 'L...

matlab 7.1 use matlab C++ math library
I wanna use matlab C++ math library into VC++6.0, but my matlab is 7.1. if i wanna use matlab C++ math library to programme, how can i setup my VC link?? why matlab7.1 doesn't have "extern->include->cpp" file??? In using matlab C++ math library , what difference between matlab 6.X and matlab7.1??? ...

Web resources about - Differences in Digits in Matlab - comp.soft-sys.matlab

Difference - Wikipedia, the free encyclopedia
Text is available under the Creative Commons Attribution-ShareAlike License ;additional terms may apply. By using this site, you agree to the ...

3Q EARNINGS: Mark Zuckerberg on the Differences Between Messenger and WhatsApp
When Facebook announced its intent to acquire cross-platform messaging application WhatsApp in February, questions surfaced on whether WhatsApp ...

Facebook Tips: What’s the Difference between Top News and Most Recent?
The following is part of our series, Facebook Tips, which answers some of the most commonly asked questions about using Facebook. While we hope ...

Recognising cultural differences is not racism
... them apart - and that's dangerous. Comparing cultural traits in these politically correct times can elicit rebukes, but brushing over the differences ...

Recognising cultural differences is not racism
... them apart - and that's dangerous. Comparing cultural traits in these politically correct times can elicit rebukes, but brushing over the differences ...

Comparison: What are the differences between the 9.7-inch iPad Pro and 12.9-inch model?
... unveiled the 9.7-inch iPad Pro . While the device is essentially the same as the larger 12.9-inch model, there are a few notable differences ...

Commission Compromise Could Have Made All the Difference
Could the fractious client-agency relationship have been salvaged if agencies had been willing to take less than 15% commission? "Losing the ...

Galaxy S7 Isocell vs Sony camera sensor: what’s the difference?
... have every right to believe all Samsung Galaxy S7 handsets are created equal, but such is not the case. And we are not only talking about differences ...

Bidwill: Chandler Jones will be a difference-maker
Arizona Cardinals president Michael Bidwill believes Chandler Jones will improve the team's chances of getting to the Super Bowl.

The marginal importance of marginal ideological differences on the Supreme Court
I am not getting the argument that Obama’s choice of a moderate justice is a massive concession even if he can be confirmed before the lame duck ...

Resources last updated: 3/31/2016 6:21:02 AM