Question

Matlab Exercises 1. Find the determinant (command: det(A)) and the condition number (command: cond(A)) of the Hilbert matrixPlease follow following scripts:

Script for part A:clear, close all; clc; W NP 3 4 5 6 n = 10; id = zeros(n,1); % allocating vector for id dA = zeros(n,1); % allocating vectorScript for Part B:

clear, close all; 3 4 y = [-4; -8; 6; -5]; A = [ 3, -5, -9; ... 8, 7, -6; ... -5, -8, 3; ... 2, -2, -9 ];

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Part A

%% part A
clear, close all; clc;

n = 10;
id = zeros(n,1); % allocating vector for id
dA = zeros(n,1); % allocating vector for det A
cA = zeros(n,1); % allocating vector for cond A

% compute hilber matrix H and its determinant and
% store it in a vector to be able to plot it
for k = 1:n
A = hilb(k); % compute H of order k
  
% remember id(for plotting)
id(k) = k;
  
% store determinant(for plotting)
dA(k) = det(A);
  
% store condition number(for plotting)
cA(k) = cond(A);
  
% display the hilbert matrix
fprintf('hilbert matrix of order k=%i\n',k);
disp(A)
end
figure(1),plot(id,dA); % plot det
xlabel('id');
ylabel('det');
set(gca,'Yscale','log'); % make the vertical axis as log
figure(2),plot(id,cA); % plot det
xlabel('id');
ylabel('cond');
set(gca,'Yscale','log'); % make the vertical axis as log

84 part A clear, close all; clc; n = 10; id = zeros (n,1); A = zeros (n,1); CA = zeros(n,1); $ allocating vector for id $allo

Output

100 10-10 10-20 10-30 10-404 10-50 10-60 1 2 3 4 5 6 7 8 9 10 id

1014 1012 1010 cond 100 1 2 3 4 5 6 7 8 9 10 id

Part - B

clear, close all;
y = [-4; -8; 6; -5]; % Enter the input
A = [ 3, -5, -9; ...
8, 7, -6; ...
-5, -8, 3; ...
2, -2, -9 ];
combinedMat= [y A]; % make a 4 x 4 matrix
if det(combinedMat) == 0 % if det is 0 then the column vectors are dependent
fprintf("y is in the subspace\n");
else
fprintf("y is not in the subspace\n");
end

** Part B clear, close all; y = (-4; -8; 6; -5]; $ Enter the input A = [ 3, -5, -9; ... 8, 7, -6; ... -5, -8, 3; ... 2, -2, -

Add a comment
Know the answer?
Add Answer to:
Please follow following scripts: Script for part A:Script for Part B: Matlab Exercises 1. Find the...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • For this project, each part will be in its oun matlab script. You will be uploading a total 3 m f...

    For this project, each part will be in its oun matlab script. You will be uploading a total 3 m files. Be sure to make your variable names descriptive, and add comments regularly to describe what your code is doing and hou your code aligns with the assignment 1 Iterative Methods: Conjugate Gradient In most software applications, row reduction is rarely used to solve a linear system Ar-b instead, an iterative algorithm like the one presented below is used. 1.1...

  • copy the text from the script, paste it into a DOC or PDF. if a Q...

    copy the text from the script, paste it into a DOC or PDF. if a Q asks to plot or display something to the screan include the plot & screan output the code generates. 2. Vector variables. Make the following variables a. aVec 3.14 15 9 26) 2.71 28 182 c. cVec [S 4.8 d. dVec-[10° 10 -48 -5] (all the numbers from 5 to-5 in increments of-0.2) (logarithmically spaced numbers between 1 1 l010 and 10, use logspace, make...

  • MATLAB Question: Write a script for the problem pictured. Please send the script, not just the...

    MATLAB Question: Write a script for the problem pictured. Please send the script, not just the printout. Make sure your script allows you to input a value for n so when prompted, in the command window, user types n value. The n value should be the f_k if k ==1 .... Please also send print outs if you can. BELOW IS A SAMPLE ANSWER THAT DID NOT PUT THE INPUT SCRIPT NEEDED FOR THIS QUESTION TO BE CORRECT. YOU CAN...

  • on matlab (1) Matrices are entered row-wise. Row commas. Enter 1 2 3 (2) Element A,...

    on matlab (1) Matrices are entered row-wise. Row commas. Enter 1 2 3 (2) Element A, of matrix A is accesser (3) Correcting an entry is easy to (4) Any submatrix of Ais obtained by d row wise. Rows are separated by semicolons and columns are separated by spaces ner A l 23:45 6. B and hit the return/enter kry matrix A is accessed as A Enter and hit the returnerter key an entry is easy through indesine Enter 19...

  • Nay programming languge is fine (MatLab, Octave, etc.) This is the whole document this last picture...

    Nay programming languge is fine (MatLab, Octave, etc.) This is the whole document this last picture i sent is the first page 5. Write and save a function Sphere Area that accepts Radius as input argument, and returns SurfaceArea (4 tt r) as output argument. Paste the function code below. Paste code here 6. Validate your Sphere Area function from the command line, checking the results against hand calculations. Paste the command line code and results below. 7. Design an...

  • Question 1 a. Define the following matrices in a script file (M-file), ? = ( 8...

    Question 1 a. Define the following matrices in a script file (M-file), ? = ( 8 9 10 11; 23 9 16 15 ;11 12 3 6; 1 2 8 9 ) ? = ( 2 21 7 15; 12 4 8 22; 23 9 5 13; 23 4 21 22) ℎ = (4 9 12 15) b. Add suitable lines of codes to the M-file to do the following. Each of the following points should be coded in only...

  • write MATLAB scripts to solve differential equations. Computing 1: ELE1053 Project 3E:Solving Differential Equations Project Principle...

    write MATLAB scripts to solve differential equations. Computing 1: ELE1053 Project 3E:Solving Differential Equations Project Principle Objective: Write MATLAB scripts to solve differential equations. Implementation: MatLab is an ideal environment for solving differential equations. Differential equations are a vital tool used by engineers to model, study and make predictions about the behavior of complex systems. It not only allows you to solve complex equations and systems of equations it also allows you to easily present the solutions in graphical form....

  • Can you help me with this question please? For the code, please do it on MATLAB. Thanks

    Can you help me with this question please? For the code, please do it on MATLAB. Thanks 7. Bonus [3+3+4pts] Before answering this question, read the Google page rank article on Pi- azza in the 'General Resources' section. The Google page rank algorithm has a lot to do with the eigenvector corresponding to the largest eigenvalue of a so-called stochastic matrix, which describes the links between websites.2 Stochastic matrices have non-negative entries and each column sums to1, and one can...

  • HERE IS THE CODE I FIXED BUT STILL DOESN'T WORK NOTE: THE VARIABLE x = zeros(size(b))...

    HERE IS THE CODE I FIXED BUT STILL DOESN'T WORK NOTE: THE VARIABLE x = zeros(size(b)) CAN'T BE CHANGED CAUSE HAS BEEN SET BY ASSESSOR HI EXPERTS I NEED HELP TO SOLVE THIS HOMEWORK PROBLEM FOR MATLAB CODE A COUPLE OF TIMES I TRIED LAST TIME TO ASK BUT ALL OF THE ANSWERS WERE WRONG PLEASE KINDLY HELP ME FIND THE RIGHT SOLUTION, ANY HELP WILL BE VERY APPRECIATE Engineering Computations and Modelling > Week 6 Homework > Backward Substitution...

  • please write code in MATLAB as well 5. (12 points) Create the following signal in Matlab:...

    please write code in MATLAB as well 5. (12 points) Create the following signal in Matlab: x[n] = u(n) - u[n-6] a. Mathematically compute yi[n] = x[n] * x[n] where * means convolution. Now use the conv command to perform the convolution. Graph x[n) and the resulting y(n), both over the interval Osns 20. How many non-zero terms does y(n) have? Does your computational result agree with the Matlab result? b. Repeat a. but this time with yz[n] = x[n]*h[n)...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT