تم الحل ✓
categoryبرمجة وتطوير البرمجيات
schoolبكالوريوس
event_available2026-07-13
السؤال
Transcribed Image Text:
2. Please write a function with one input, a matrix, and one output, a matrix of the same size. The
output matrix should be the input matrix mirrored on the vertical axis. For instance, the input:
[1 2 3]
4 5 6
7 8 9
Would become:
[321]
6 5 4
[987]
And the input:
Would become:
[1 1 2 21
2 2 1 1
1 1 2 2
[2 2 1 11
1 1 2 2
2 2 1 1
Note that this functions slightly differently for inputs with odd and even numbers of columns. For
an odd number of columns, your centermost column stays the same. For an even number of
columns, all columns are moved in the resulting output. You can use the function
[yDim, xDim] = size(matrixName)
To determine the number of rows (yDim) and columns (xDim) of any matrix (matrixName). This
may help you in completing your task. You must use nested loops to accomplish this, and may
not use any built-in MATLAB functions that move values inside of arrays, such as rot90
check_circle الجواب — حل مفصل خطوة بخطوة
hourglass_top
🔒
الحل الكامل متاح للمشتركين
اشترك في أرشيف الأسئلة لعرض هذا الحل وآلاف الحلول المفصلة خطوة بخطوة من معلمين معتمدين.