

Studia grazie alle numerose risorse presenti su Docsity
Guadagna punti aiutando altri studenti oppure acquistali con un piano Premium
Questa pagina non è visibile nell’anteprima
Non perderti parti importanti!


Linear Algebra and Geometry - Scientific Computing
a) x([1 4 3]); b) x([1:2:7 10])=zeros(1,5); c) x([1 2 5])=[0.5*ones(1,2) -0.3]; d) y=x(end:-1:1).
A =
and type the following MATLAB instructions, understanding their meaning:
a) size(A); b) A(1:2,4), A(:,3), A(1:2,:), A(:,[2,4]), A([2 3 3],:); c) A(3,2)=A(1,1); d) A(1:2,4)=zeros(2,1); e) A(2,:)=A(2,:)-A(2,1)/A(1,1)*A(1,:).;
After that:
a) assemble the matrix B made by the columns of A in reverse order (that is to say the first column of B is the 6th^ of A, the 2nd^ of B is the 5th^ of A, ...). b) assemble the matrix made by the even columns of A; c) assemble the matrix made by the odd rows of A; d) assemble the matrix made by rows 1,4,3 and columns 5,2 of A; e) assemble the vector made by the diagonal elements akk, k = 1, ..., 4 of A;
f (x) = sin(x) x ∈ [−π, π] ; f (x) = ex^ x ∈ [− 1 , 1] ; f (x) = e−x 2 x ∈ [−π, π] ;
f (x) = sin( x x) x ∈ (0, 4 π] ; f (x) = x sin( (^1) x ) x ∈ (0, 2] ;
f (x) =
100(1 − 0. 01 x^2 )^2 + 0. 02 x^2 (1 − x^2 )^2 + 0. 1 x^2
x ∈ [0. 1 , 100] ,
using the MATLAB commands plot and loglog. Evaluate the function at sufficiently large number of points in the range of interest. Comment the results.
f (x) =
− 2 x, x < 0 , 0 , x = 0, 2 x, x > 0 ,
both at a generic point x and at each point of a vector. After that, graphically represent the function f in the interval [-1,1].
ex^ ≈ 1 + x +
x^2 2!
x^3 3!
xn n!
of degree n, 0-centered. Stop the summation when the term x
i i! is less than a fixed tolerance^ tol. Run the function with x = 1, tol = 1. 0 e − 10 and compute the relative error linked to the value of the polynomial at x, using as exact value the one given by the Matlab function exp(x).