%========================================================================= % Uplny problem pro urceni vlastnich cisel %========================================================================= %------------------------------------------------------------------------- % function [L,U] = lu_rozklad(A); % LU-rozklad pro ctvercovou matici A %------------------------------------------------------------------------- A=[7 1 3 1 2; 2 8 6 1 5; 2 4 8 1 2; 3 4 1 7 1; 2 3 5 1 3]; [L,U] = lu_rozklad(A) %------------------------------------------------------------------------- % function [lambda, chyba] = lr_transformace(A, epsilon, max_iter); % % LR-algoritmus pro vypocet vlastnich cisel matice A %------------------------------------------------------------------------- A=[7 1 3 1 2; 2 8 6 1 5; 2 4 8 1 2; 3 4 1 7 1; 2 3 5 1 3]; lr_transformace(A, 0.001, 100); %------------------------------------------------------------------------- % function [lambda, chyba] = qr_transformace(A, epsilon, max_iter); % % QR-algoritmus pro vypocet vlastnich cisel matice A %------------------------------------------------------------------------- A=[7 1 3 1 2; 2 8 6 1 5; 2 4 8 1 2; 3 4 1 7 1; 2 3 5 1 3]; qr_transformace(A, 0.001, 100); %------------------------------------------------------------------------- % function [lambda, chyba] = jacobiova_diagonalizace_I(A, epsilon, max_iter); % % Metoda Jacobiovy diagonalizace pro vypocet vlastnich cisel matice A % (specialni pripad metody qr-transformace) % % postupna volba matic rotace %------------------------------------------------------------------------- A=[64 51 47 37 39; 51 130 95 56 74; 47 95 89 39 63; 37 56 39 76 33; 39 74 63 33 48]; jacobiova_diagonalizace_I(A, 0.001, 100); %------------------------------------------------------------------------- % function [lambda, chyba] = jacobiova_diagonalizace_II(A, epsilon, max_iter); % % Metoda Jacobiovy diagonalizace pro vypocet vlastnich cisel matice A % (specialni pripad metody qr-transformace) % % volba maximalniho prvku v absolutni hodnote pro ziskani matice rotace %------------------------------------------------------------------------- A=[64 51 47 37 39; 51 130 95 56 74; 47 95 89 39 63; 37 56 39 76 33; 39 74 63 33 48]; jacobiova_diagonalizace_II(A, 0.001, 100); %========================================================================= % Castecny problem pro urceni vlastnich cisel %========================================================================= %------------------------------------------------------------------------- % function [lambda, chyba] = mocninna_metoda(A, y_0, epsilon, max_iter); % % Mocninna metoda pro vypocet % dominantniho vlastniho cisla matice A % % y_0 ... pocatecni aproximace % epsilon ... tolerance pro zastaveni vypoctu % max_iter ... maximalni pocet iteraci %------------------------------------------------------------------------- A=[2 1 1 0; 1 3 1 1; 1 1 4 1; 0 1 1 5]; y0=[1 1 1 1]'; mocninna_metoda(A, y0, 0.001, 50); mocninna_metoda_norm(A, y0, 0.001, 50); %------------------------------------------------------------------------- function [lambda, chyba] = metoda_rayleighova_podilu(A, y_0, epsilon, max_iter); % % Metoda Rayleighova podilu pro vypocet % dominantniho vlastniho cisla matice A %------------------------------------------------------------------------- metoda_rayleighova_podilu(A, y0, 0.001, 50); metoda_rayleighova_podilu_norm(A, y0, 0.001, 50); A=[2 0 0; 0 1 0; 0 -2 3]; y0=[1 1 1]'; mocninna_metoda(A, y0, 0.001, 50); mocninna_metoda_norm(A, y0, 0.001, 50); metoda_rayleighova_podilu(A, y0, 0.001, 50); metoda_rayleighova_podilu_norm(A, y0, 0.001, 50); [Vlastni_vektory,Spektralni_matice] = eig(A) A=[2 0 0; 0 1 0; 0 -2 3]; y0=[1 2 1]'; mocninna_metoda(A, y0, 0.001, 50); mocninna_metoda_norm(A, y0, 0.001, 50); metoda_rayleighova_podilu(A, y0, 0.001, 50); metoda_rayleighova_podilu_norm(A, y0, 0.001, 50);