필터 지우기
필터 지우기

What is "peaks" in tutorialApp?

조회 수: 3 (최근 30일)
Ken
Ken 2023년 12월 24일
댓글: Voss 2024년 4월 4일
I am learning Matlab graphical user interface tools. I find that tutorialApp.mlapp seems to be a readily available thing, embedded in Matlab itself. I have successfully run it. Now, looking at the code, I would like to understand it better and play with it some. These lines (16-18) seem to be doing the hard work of building the graph:
value = app.AmplitudeSlider.Value;
plot(app.UIAxes, value*peaks)
app.UIAxes.YLim = [-1000 1000];
Okay, so it would appear that the data must be contained in this object called peaks. But I can't find that object defined anywhere. Where is it, and what is its type? Or if I'm wrong, where is the data, really?
  댓글 수: 1
Dyuman Joshi
Dyuman Joshi 2023년 12월 24일
"Where is it, and what is its type? Or if I'm wrong, where is the data, really?"
As Voss has mentioned, it is a built-in function, i.e. it comes with MATLAB.
You can use the MATLAB Documentation to search for such functions, either online or on your MATLAB app using help like this -
help peaks
PEAKS A sample function of two variables. PEAKS is a function of two variables, obtained by translating and scaling Gaussian distributions, which is useful for demonstrating MESH, SURF, PCOLOR, CONTOUR, etc. There are several variants of the calling sequence: Z = PEAKS; Z = PEAKS(N); Z = PEAKS(V); Z = PEAKS(X,Y); PEAKS; PEAKS(N); PEAKS(V); PEAKS(X,Y); [X,Y,Z] = PEAKS; [X,Y,Z] = PEAKS(N); [X,Y,Z] = PEAKS(V); The first variant produces a 49-by-49 matrix. The second variant produces an N-by-N matrix. The third variant produces an N-by-N matrix where N = length(V). The fourth variant evaluates the function at the given X and Y, which must be the same size. The resulting Z is also that size. The next four variants, with no output arguments, do a SURF plot of the result. The last three variants also produce two matrices, X and Y, for use in commands such as PCOLOR(X,Y,Z) or SURF(X,Y,Z,DEL2(Z)). If not given as input, the underlying matrices X and Y are [X,Y] = MESHGRID(V,V) where V is a given vector, or V is a vector of length N with elements equally spaced from -3 to 3. If no input argument is given, the default N is 49. Documentation for peaks doc peaks

댓글을 달려면 로그인하십시오.

답변 (2개)

Voss
Voss 2023년 12월 24일
  댓글 수: 1
Voss
Voss 2024년 4월 4일
@Ken: Did this answer clarify the problem? If so, please Accept it.

댓글을 달려면 로그인하십시오.


Image Analyst
Image Analyst 2023년 12월 24일
peaks a built-in function that you can actually open up and look at in the editor. Do this at the command line:
>> edit peaks.m

카테고리

Help CenterFile Exchange에서 Descriptive Statistics에 대해 자세히 알아보기

제품


릴리스

R2023b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by