Prev: using case statement on string inputs when number of case choices is unknown
Next: Biulding a diagonal matrix from submatrices
From: Sayanatn on 19 Mar 2010 20:08 Posting what it showing >> which -all fzero C:\Users\name\Doc\MATLAB\fzero.m C:\Program Files (x86)\MATLAB\R2008b\toolbox\matlab\funfun\fzero.m % Shadowed >> there is nothing named ja , now? "Steven Lord" <slord(a)mathworks.com> wrote in message <ho0rqt$ppb$1(a)fred.mathworks.com>... > > "Sayanatn " <sayan.polo(a)gmail.com> wrote in message > news:ho0p5g$c8b$1(a)fred.mathworks.com... > >I tried to do the following > > > > > > % begin f.m > > function y = f > > y = fzero(@subfunF, 2); > > > > function z = subfunF(x) > > z = x.^3-2*x-5; > > % end f.m > > > > but the error was still there as follows > > > > ??? Error: File: fzero.m Line: 1 Column: 8 > > Unexpected MATLAB expression. > > > > Error in ==> f at 4 > > y = fzero(@subfunF, 2); > > > >>> > > > > what should i do , ia m reading getting started > > Type the following command and post what it says: > > which -all fzero > > If the first instance that comes up is in a directory named ja, remove all > directories named ja from your path using the File -> Set Path menu item. > The files in the /ja directories are Japanese help text files; they don't > contain the actual function code, and should not be on your path. > > -- > Steve Lord > slord(a)mathworks.com > comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ >
From: Sayanatn on 19 Mar 2010 21:13 hey , thanks a lot i deleted the one with the same name and its working great ,,,thanks for your help i do appreciate it its just that i am learning this to work on a big equation i dont know if fzero will work for complesx equation .."Sayanatn " <sayan.polo(a)gmail.com> wrote in message <ho13l2$m3u$1(a)fred.mathworks.com>... > Posting what it showing > > >> which -all fzero > C:\Users\name\Doc\MATLAB\fzero.m > C:\Program Files (x86)\MATLAB\R2008b\toolbox\matlab\funfun\fzero.m % Shadowed > >> > there is nothing named ja , now? > > "Steven Lord" <slord(a)mathworks.com> wrote in message <ho0rqt$ppb$1(a)fred.mathworks.com>... > > > > "Sayanatn " <sayan.polo(a)gmail.com> wrote in message > > news:ho0p5g$c8b$1(a)fred.mathworks.com... > > >I tried to do the following > > > > > > > > > % begin f.m > > > function y = f > > > y = fzero(@subfunF, 2); > > > > > > function z = subfunF(x) > > > z = x.^3-2*x-5; > > > % end f.m > > > > > > but the error was still there as follows > > > > > > ??? Error: File: fzero.m Line: 1 Column: 8 > > > Unexpected MATLAB expression. > > > > > > Error in ==> f at 4 > > > y = fzero(@subfunF, 2); > > > > > >>> > > > > > > what should i do , ia m reading getting started > > > > Type the following command and post what it says: > > > > which -all fzero > > > > If the first instance that comes up is in a directory named ja, remove all > > directories named ja from your path using the File -> Set Path menu item. > > The files in the /ja directories are Japanese help text files; they don't > > contain the actual function code, and should not be on your path. > > > > -- > > Steve Lord > > slord(a)mathworks.com > > comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ > >
From: Sayanatn on 19 Mar 2010 21:44 Hey I was trying to find complex zeroes by this code % begin f.m function y = f fid = fopen('Newtons.dat','w');%%the file where the output will be saved,fopen opens a file which is writeable%% y = fzero(@subfunF,-2i); fprintf(fid,'%15.12f \n',y); fclose(fid) function z = subfunF(x) z=x.^2+2*x-4i; %%z = x.^3-2*x -5; % end f.m but its showing error as ??? Error using ==> fzero at 334 Function value at starting guess must be finite and real. Error in ==> f at 5 y = fzero(@subfunF,-2i); >> how should i fix it? "Sayanatn " <sayan.polo(a)gmail.com> wrote in message <ho17f2$gch$1(a)fred.mathworks.com>... > hey , > thanks a lot i deleted the one with the same name and its working great ,,,thanks for your help i do appreciate it its just that i am learning this to work on a big equation i dont know if fzero will work for complesx equation .."Sayanatn " <sayan.polo(a)gmail.com> wrote in message <ho13l2$m3u$1(a)fred.mathworks.com>... > > Posting what it showing > > > > >> which -all fzero > > C:\Users\name\Doc\MATLAB\fzero.m > > C:\Program Files (x86)\MATLAB\R2008b\toolbox\matlab\funfun\fzero.m % Shadowed > > >> > > there is nothing named ja , now? > > > > "Steven Lord" <slord(a)mathworks.com> wrote in message <ho0rqt$ppb$1(a)fred.mathworks.com>... > > > > > > "Sayanatn " <sayan.polo(a)gmail.com> wrote in message > > > news:ho0p5g$c8b$1(a)fred.mathworks.com... > > > >I tried to do the following > > > > > > > > > > > > % begin f.m > > > > function y = f > > > > y = fzero(@subfunF, 2); > > > > > > > > function z = subfunF(x) > > > > z = x.^3-2*x-5; > > > > % end f.m > > > > > > > > but the error was still there as follows > > > > > > > > ??? Error: File: fzero.m Line: 1 Column: 8 > > > > Unexpected MATLAB expression. > > > > > > > > Error in ==> f at 4 > > > > y = fzero(@subfunF, 2); > > > > > > > >>> > > > > > > > > what should i do , ia m reading getting started > > > > > > Type the following command and post what it says: > > > > > > which -all fzero > > > > > > If the first instance that comes up is in a directory named ja, remove all > > > directories named ja from your path using the File -> Set Path menu item. > > > The files in the /ja directories are Japanese help text files; they don't > > > contain the actual function code, and should not be on your path. > > > > > > -- > > > Steve Lord > > > slord(a)mathworks.com > > > comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ > > >
From: Sayanatn on 19 Mar 2010 23:24 I am sorry to bother again but i am in real fixation how to do the previous posted message and how to calcualte the zeroes of x^3+2*x^2+x+4i=0 depending upon the initial guess i am not getting anyresult even if the constant term is non imaginary (i.e 4i=4)Please please help me how to proceeed Regards SD "Sayanatn " <sayan.polo(a)gmail.com> wrote in message <ho1993$cat$1(a)fred.mathworks.com>... > Hey > I was trying to find complex zeroes by this code > > % begin f.m > function y = f > fid = fopen('Newtons.dat','w');%%the file where the output will be saved,fopen opens a file which is writeable%% > y = fzero(@subfunF,-2i); > fprintf(fid,'%15.12f \n',y); > > fclose(fid) > > > function z = subfunF(x) > z=x.^2+2*x-4i; > %%z = x.^3-2*x -5; > % end f.m > > but its showing error as > > ??? Error using ==> fzero at 334 > Function value at starting guess must be finite and real. > > Error in ==> f at 5 > y = fzero(@subfunF,-2i); > > >> > > how should i fix it? > "Sayanatn " <sayan.polo(a)gmail.com> wrote in message <ho17f2$gch$1(a)fred.mathworks.com>... > > hey , > > thanks a lot i deleted the one with the same name and its working great ,,,thanks for your help i do appreciate it its just that i am learning this to work on a big equation i dont know if fzero will work for complesx equation .."Sayanatn " <sayan.polo(a)gmail.com> wrote in message <ho13l2$m3u$1(a)fred.mathworks.com>... > > > Posting what it showing > > > > > > >> which -all fzero > > > C:\Users\name\Doc\MATLAB\fzero.m > > > C:\Program Files (x86)\MATLAB\R2008b\toolbox\matlab\funfun\fzero.m % Shadowed > > > >> > > > there is nothing named ja , now? > > > > > > "Steven Lord" <slord(a)mathworks.com> wrote in message <ho0rqt$ppb$1(a)fred.mathworks.com>... > > > > > > > > "Sayanatn " <sayan.polo(a)gmail.com> wrote in message > > > > news:ho0p5g$c8b$1(a)fred.mathworks.com... > > > > >I tried to do the following > > > > > > > > > > > > > > > % begin f.m > > > > > function y = f > > > > > y = fzero(@subfunF, 2); > > > > > > > > > > function z = subfunF(x) > > > > > z = x.^3-2*x-5; > > > > > % end f.m > > > > > > > > > > but the error was still there as follows > > > > > > > > > > ??? Error: File: fzero.m Line: 1 Column: 8 > > > > > Unexpected MATLAB expression. > > > > > > > > > > Error in ==> f at 4 > > > > > y = fzero(@subfunF, 2); > > > > > > > > > >>> > > > > > > > > > > what should i do , ia m reading getting started > > > > > > > > Type the following command and post what it says: > > > > > > > > which -all fzero > > > > > > > > If the first instance that comes up is in a directory named ja, remove all > > > > directories named ja from your path using the File -> Set Path menu item. > > > > The files in the /ja directories are Japanese help text files; they don't > > > > contain the actual function code, and should not be on your path. > > > > > > > > -- > > > > Steve Lord > > > > slord(a)mathworks.com > > > > comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ > > > >
From: Matt Fig on 19 Mar 2010 23:53
Please don't top post. Since you have a polynomial, use roots. f = @(x) x.^3+2*x.^2+x+4*i; rt = roots([1 2 1 4*i]) f(rt) % Just to check |