Write Matlab
Determine the constant of array A after the following statement are executed
A=[4 7 3; 9 12 6; 7 6 9]
i. A([1,3],:)=A([2],:)
ii. C=eye(3,3) b=[1 2 3] C(2,:)=b
A=[4 7 3; 9 12 6; 7 6 9]
I) A([1,3],:)=A([2],:) %produces error because we cannot assign two rows in this manner
Correct statement is : A([1,3],:)= A([2, 2],:) % replace 1 and 3 row with elements in 2nd row
Output:
A =
9 12 6
9 12 6
9 12 6
II)
C = eye(3,3)
b = [1 2 3]
C(2,:)=b %assigning vector v to row 2 of matrix c
Output:
C =
1 0 0
0 1 0
0 0 1
b =
1 2 3
C =
1 0 0
1 2 3
0 0 1
Write Matlab Determine the constant of array A after the following statement are executed A=[4 7...
In the blank below, write the contents of array arr after the following code is executed up to the comment indicated in the main procedure below? #include <iostream> #include <algorithm> using namespace std; void do something(int list[], const int size); int main() { const int SIZE(10); int arr[SIZE] = { 5, 8, 1, 7, 3, 9, 4, 6, 10, 2 }; do somethingCarr, SIZE); ** Write the contents of array arr in the space below when execution reaches here. */...
matlab help Write a script to manipulate the array A = [2 1 4 3 6 5 8 7 10 9 12 11 14 13 16 15 18 17 20 19] to be in descending order without using the sort function. You must do everything using array manipulation in MATLAB (i.e. you cannot sort it by hand and then hardcode it, you cannot simply create the array 1:20, you cannot simply add .rej3mat(J-l 1],1,10) to A). Write a script that...
Consider the following lines of Matlab code 1 arr-14,7.2,5,1,6: 2 for j 2:length(arr) 3 key arr) 4 i j-1; 5 while i - 1 && arr)> key 6 arr(+1) arr(); 8 end %end of while loop 9 arr(+1) key 10 end %end of for loop After line 8 gets executed the first time, the state of the array arr is. arr [4, 7, 7, 5, 1, 6] What is the state of the array arr after line 8 is executed...
the programed used is Matlab but i want the answer by hand without Matlab %HW# 8 Ex clearicle 4 A-nones (3, 3) B = (n+1 ) *ones (3,3) ; C-ones (3,3) while ( A(1,1)+A (1,2)+A (1,3) <- 80,1)+83,21 ,3) for rr = 1:3 for cc 1:3 end end end %HW# 8 Ex clearicle 4 A-nones (3, 3) B = (n+1 ) *ones (3,3) ; C-ones (3,3) while ( A(1,1)+A (1,2)+A (1,3)
I have x=[1 ; 2 ; 4 ; 5 ; 7 ; 9 ; 3] can you write matlab code of column array that calculate midpoint between every two points. eg [(1+2)/2; (2+4)/2;(4+5)/2;(5+7)/2...] answer should give x_midpoint=[1.5 ; 3 ; 4.5 ; .....]
5. (7 pts) What wil display on the output screen after following program is executed? includeciostream using namespace std int b 40 int A function(int a) int main (void) int c 7, b 15 cout<cA function (e) <cendla return 6 int A function (int a) int i cout<<b<<endl; if (a>-0) else return i i-ai i--ai Ans5 6. (7 pts) Show what will appear on the output screen after the following program is executed tincludeciostream> using namespace std; void A function...
1.Show the state of the following array after the outer loop of the bubble sort algorithm has executed one time. [0] [1] [2] [3] [4] [5] 19 23 2 4 99 1 2. Show the state of the following array after the outer loop of the selection sort algorithm has executed two times. [0] [1] [2] [3] [4] [5] 12 1 9 23 17 11 3. Show the state of the following array after the outer loop of the insertion...
in MATLAB 4-5], what will be displayed ifthe following Given u 1-3 2 executed by MATLAB? nu (a)1 1 (b) 1 -3 4 -5 (c) -1 2 (d) 1 (e) o 1
1.) If the commands below will be executed in order, determine the output of the 4 echo commands (labeled as A-D): (2 Marks) ra7 export b=9 echo $r 9=3 echo $b -B be8 bash echo $g exit echo $b -D exit ii.) Given the contents of file (filename: /home/user5/table) below, write the single command line needed to perform the following tasks. 7 2 Services 1 Executive Summary 1.1 Olives 12 6 Financial Plan Important Assumption Startup Funding Requirements Other Current...
In Matlab Consider the array A. 10 3 5 -4 12 -5 9 2 A= 6 13 -8 11 115 -5 4 1 Write a program that computes the array B by computing the square of all the elements of A whose value is greater than 10 and multiplying 5 to each element that is less than or equal to 10. You need to use a logical array as a mask.