Tema de casa laborator 3 CNA

Tema de casa laborator 3 CNA - Tema de casa 3 CNA Crabat...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Tema de casa 3 CNA Crabat Andreea 331AA Tema de casa laborator 3 CNA A+B+E3.1.+E3.2. function [F]=f1(A) %Calculeaza functie de matrice pe baza calculului vectorilor si valorilor proprii [n,n]=size(A); [V,L]=eig(A); D=zeros(n,n); for i=1:n D(i,i)=sin(L(i,i)); % D(i,i)=cos(L(i,i)); % D(i,i)=exp(L(i,i)); % D(i,i)=sqrt(L(i,i)); end F=(V*D)/V; F=real(F); » A=rand(3) A = 0.3858 0.1475 0.5901 0.3877 0.5872 0.9554 0.4997 0.8456 0.5561 » funm(A,'sin') ans = 0.2721 -0.0016 0.4031 0.1781 0.3066 0.6105 0.2958 0.5685 0.2332 » f1(A) ans = 0.2721 -0.0016 0.4031 0.1781 0.3066 0.6105 0.2958 0.5685 0.2332 -1-
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Tema de casa 3 CNA Crabat Andreea 331AA function [F]=parl(T) %Algoritmul Parlett de calcul al functiilor de matrice, pentru matrice superior triunghiulare [n,n]=size(T); for i=1:n F(i,i)=sin(T(i,i)); % F(i,i)=cos(T(i,i)); % F(i,i)=exp(T(i,i)); % F(i,i)=sqrt(T(i,i)); end for p=1:n-1 for i=1:n-p j=i+p; s=T(i,j)*(F(j,j)-F(i,i)); if(p>1) for k=i+1:j-1 s=s+T(i,k)*F(k,j)-F(i,k)*T(k,j); end end F(i,j)=s/(T(j,j)-T(i,i)); end end » A=triu(rand(3)) A = 0.1482 0.1418 0.4885 0 0.5649 0.4640 0 0 0.9611 » funm(A,'sin') ans = 0.1476 0.1319 0.3868 0 0.5353 0.3332 0 0 0.8198 » parl(A) ans = 0.1476 0.1319 0.3868 0 0.5353 0.3332 0 0 0.8198 -2-
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 8

Tema de casa laborator 3 CNA - Tema de casa 3 CNA Crabat...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online