Matlab functie ezplot werkt niet

Moderators: ArcherBarry, Fuzzwood

Reageer
Berichten: 3

Matlab functie ezplot werkt niet

Welke held kan mij helpen?

Met matlab lukt het me hoe dan ook gewoon niet om een ezplot te doen.

Voorbeeldje: Ik heb een M file met :

function y = p(x)

y=(x.^3-2).^2;


Die m file heb ik 'p' genoemd. Hij heet dus p.m

Maar wat ik ook invoer, ik krijg foutmeldingen:

>> ezplot('p(x)')

??? Undefined function or method 'ezplot' for input arguments of type

'char'.


Ik post ze niet alle opties die ik heb geprobeerd, maar werkelijk alle variaties, kleuren, geuren en smaken heb ik geprobeerd.

En zelfs als ik bvb een invoer kopieer, bvb van hier :http://www.mathworks.nl/help/techdoc/ref/ezplot.html geeft het bij mij een foutmelding.

Gezien ik werkelijk alle invoeren heb geprobeerd vrees ik dat de fout in matlab of mijn laptop zit, en niet in de invoer. Heeft iemand een verklaring?

Berichten: 7.068

Re: Matlab functie ezplot werkt niet

Ik heb net een functie p.m aangemaakt en doe dan in Octave (Matlab-compatible):

Code: Selecteer alles

ezplot('p(x)')
en dan plot ie gewoon een grafiek.

Je foutmelding zegt dat hij de functie ezplot niet kent. Zit deze functie in een pakket dat je niet geinstalleerd hebt? Wat gebeurt er als je 'help ezplot' doet?

Berichten: 3

Re: Matlab functie ezplot werkt niet

Fijn om bevestigd te krijgen dat het inderdaad niet aan mij ligt :)

Hoe het met de installatie zit weet ik niet. Bij ons op de tu staat alles al geinstalleerd als je een laptop koopt....

Als ik help ezplot intyp krijg ik dit:

>> help ezplot

--- help for sym/ezplot ---

EZPLOT Easy to use function plotter.

EZPLOT(f) plots the expression f = f(x) over the default

domain -2*pi < x < 2*pi.



EZPLOT(f, [a,b]) plots f = f(x) over a < x < b and



For implicitly defined functions, f = f(x,y)

EZPLOT(f) plots f(x,y) = 0 over the default domain

-2*pi < x < 2*pi and -2*pi < y < 2*pi

EZPLOT(f, [xmin,xmax,ymin,ymax]) plots f(x,y) = 0 over

xmin < x < xmax and ymin < y < ymax.

EZPLOT(f, [a,b]) plots f(x,y) = 0 over a < x < b and a < y < b.

If f is a function of the variables u and v (rather than x and y), then

the domain endpoints a, b, c, and d are sorted alphabetically. Thus,

EZPLOT(u^2 - v^2 - 1,[-3,2,-2,3]) plots u^2 - v^2 - 1 = 0 over

-3 < u < 2, -2 < v < 3.



EZPLOT(x,y) plots the parametrically defined planar curve x = x(t)

and y = y(t) over the default domain 0 < t < 2*pi.

EZPLOT(x,y, [tmin,tmax]) plots x = x(t) and y = y(t) over

tmin < t < tmax.



EZPLOT(f, [a,b], FIG}, EZPLOT(f, [xmin,xmax,ymin,ymax], FIG), or

EZPLOT(x,y, [tmin,tmax], FIG) plots the given function over the

specified domain in the figure window FIG.



Examples:

syms x y t

ezplot(cos(x))

ezplot(cos(x), [0, pi])

ezplot(x^2 - y^2 - 1)

ezplot(x^2 + y^2 - 1,[-1.25,1.25],3); axis equal

ezplot(1/y-log(y)+log(-1+y)+x - 1)

ezplot(x^3 + y^3 - 5*x*y + 1/5,[-3,3])

ezplot(x^3 + 2*x^2 - 3*x + 5 - y^2)

ezplot(sin(t),cos(t))

ezplot(sin(3*t)*cos(t),sin(3*t)*sin(t),[0,pi])

Reference page in Help browser

doc sym/ezplot

Berichten: 7.068

Re: Matlab functie ezplot werkt niet

Code: Selecteer alles

syms x y t

ezplot(cos(x))
Doet dit het dan wel?

Berichten: 3

Re: Matlab functie ezplot werkt niet

EvilBro schreef:

Code: Selecteer alles

syms x y t

ezplot(cos(x))
Doet dit het dan wel?
>> syms x y t

>> ezplot(cos(x))

??? Undefined function or method 'ezplot' for input arguments of type 'char'.

Error in ==> sym.ezplot at 45

h = ezplot(char(f));

Berichten: 7.068

Re: Matlab functie ezplot werkt niet

Vaag...

Berichten: 7.068

Re: Matlab functie ezplot werkt niet

Ik denk dat je dit moet doen:

Code: Selecteer alles

ezplot(@p)

Gebruikersavatar
Moderator
Berichten: 4.094

Re: Matlab functie ezplot werkt niet

Bij mij doet ezplot het wel gewoon (Matlab R2010b). Wel moet die cos x nog tussen aanhalingstekens, dus:

Code: Selecteer alles

syms x y t

ezplot('cos(x)')

Gebruikersavatar
Berichten: 7.390

Re: Matlab functie ezplot werkt niet

physicalattraction schreef: ma 02 apr 2012, 12:18
Bij mij doet ezplot het wel gewoon (Matlab R2010b). Wel moet die cos x nog tussen aanhalingstekens, dus:

Code: Selecteer alles

syms x y t

ezplot('cos(x)')


Werkt met én zonder bij mij (R2011a).
"C++ : Where friends have access to your private members." Gavin Russell Baker.

Reageer