Ask your own question, for FREE!
Computer Science 17 Online
OpenStudy (anonymous):

MATLAB101 help D: I'll attached the problem below.

OpenStudy (anonymous):

I just wanted to see how this will look like. Don't show me the code (I have to figure this one out), just show me your output, so that I can have an idea.

OpenStudy (anonymous):

...a little bit of hints, maybe?

OpenStudy (dan815):

okay so

OpenStudy (dan815):

u have a 50 by 50 matrix and what are we trying do here with peaks function?

OpenStudy (anonymous):

from what I understand, i have to make the 50 by 50 matrices using the "peaks" function. What's a peak function anyway?

OpenStudy (dan815):

www.mathworks.com/help/matlab/ref/peaks.html

OpenStudy (anonymous):

Yeah I read that. I'm not sure if I should do Z=peaks(x,y) or do z=peaks(50), x=peaks(50), y=peaks(50) because it says "Use the peaks function to define X,Y,Z" not sure what this part actually means

OpenStudy (dan815):

im looking it up

OpenStudy (dan815):

do u hae some data set of some function i can use peaks on?

OpenStudy (kva1992):

I believe you should be using the Z=peaks(x,y)

OpenStudy (kva1992):

dont quote me but im pretty sure

OpenStudy (dan815):

okay

OpenStudy (dan815):

what is x and y

OpenStudy (anonymous):

no i don't have any set of data.. if i did that, this is how it will look like:

OpenStudy (anonymous):

is it supposed to be like that? O.o

OpenStudy (kva1992):

Z = peaks(X,Y); evaluates peaks at the given X and Y (which must be the same size) and returns a matrix the same size.

OpenStudy (kva1992):

so if im not misinterpreting that your x and y are 50

OpenStudy (dan815):

x and y are both 50 by 50 matrices?

OpenStudy (kva1992):

gimme a second lol i may be mistaken

OpenStudy (dan815):

oh crapp i cant use peaks i accidentally named some other program peaks, i gotta put in that program in for peaks again

OpenStudy (anonymous):

wait i'm confused now, do i need to define x and y with some function?

OpenStudy (dan815):

can you open your peaks function code

OpenStudy (kva1992):

well if we are basing it off the definition then yes you have to define the x and y and they both must be the same value

OpenStudy (dan815):

ok nvm i just renamed the file i can use peaks again

OpenStudy (dan815):

http://prntscr.com/8pzvg0

OpenStudy (dan815):

like that?

OpenStudy (kva1992):

yup thats what it should look like from what i have knowledge of

OpenStudy (anonymous):

did you do z=peaks(50) figure mesh(Z) ?

OpenStudy (dan815):

>> [X,Y,Z]=peaks(50) >> surf(X,Y,Z)

OpenStudy (anonymous):

surf(x,y,z) isn't the x and y here represents the matrix then z will be the color of data and the surface height? okay. thank you, i think i got it now :D

OpenStudy (dan815):

[X,Y,Z] = peaks(...); returns two additional matrices, X and Y, for parametric plots, for example, surf(X,Y,Z,del2(Z)). If not given as input, the underlying matrices X and Y are [X,Y] = meshgrid(V,V)

OpenStudy (dan815):

u should mess around with it like

OpenStudy (dan815):

what happens when you put in a meshed grid 50 by 50 for peaks

OpenStudy (anonymous):

ok, i'll try that. I already get the idea, so I think I can manage it now I'll ask again if I got stuck or confused :P

OpenStudy (anonymous):

quick question, are your matrices like the list of numbers/data showing on your command window?

OpenStudy (anonymous):

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!