필터 지우기
필터 지우기

adding only to the y value in matrix

조회 수: 3 (최근 30일)
Paul Jackson
Paul Jackson 2021년 2월 11일
답변: Steven Lord 2021년 2월 11일
I need to add a constant only to the y value of all inputs in a matrix.
The task is to make it look like its lifted upwards on a graph.
  댓글 수: 3
Paul Jackson
Paul Jackson 2021년 2월 11일
It seems like i misunderstood the task. It seems like I need to create a matrix that has 0 for every x value and the value i want to add for every y value. I then need to add that matrix to the original one
Geoff Hayes
Geoff Hayes 2021년 2월 11일
Or just add a constant to the column (or row) of the matrix that has the y data. You may need to show us what your current matrix looks like (how is it constructed, where are the x and y values), etc.

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

채택된 답변

Steven Lord
Steven Lord 2021년 2월 11일
The answer depends on how you're storing your coordinate data. Is it stored as two columns, the first x and the second y?
v = (1:10).';
xy = [v, v.^2];
plot(xy(:, 1), xy(:, 2))
If so just add your constant to the second column of xy.
Is your data stored as arrays of points each containing x, y, and z data?
[x, y, z] = peaks;
surf(x, y, z)
If so add your constant to the y array.
Is your data stored as an image?
im = imread('ngc6543a.jpg');
imshow(im)
In this case you'll probably want to add the 'XData' and 'YData' options to your imshow call.
Or is it stored in some other way? If so please describe how you're storing your data.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Data Type Identification에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by