cd ../../works/courses/LSC/LSC-15/matlab/ Dolomiti = imread('TreCime.jpg'); imshow(Dolomiti) whos('Dolomiti') Name Size Bytes Class Attributes Dolomiti 1000x1500x3 4500000 uint8 spectrum = zeros(size(Dolomiti)); whos('spectrum') Name Size Bytes Class Attributes spectrum 1000x1500x3 36000000 double spectrum(:,:,1) = fftshift(fft2(double(Dolomiti(:,:,1)))); spectrum(:,:,2) = fftshift(fft2(double(Dolomiti(:,:,2)))); spectrum(:,:,3) = fftshift(fft2(double(Dolomiti(:,:,3)))); spectrum( 2:3, 2:3, : ) ans(:,:,1) = 1.0e+03 * 1.2085 + 0.3997i 0.6586 - 0.2758i -0.5305 - 1.4076i 0.5219 + 0.9813i ans(:,:,2) = 1.0e+03 * 1.1506 - 0.1132i 1.1545 - 0.3229i -0.1895 - 0.7068i 0.9070 + 0.6743i ans(:,:,3) = 1.0e+03 * 1.4042 + 0.1812i 1.3858 - 0.4079i -0.0901 - 1.0356i 1.3318 + 1.4577i Dol = zeros(size(Dolomiti)); Dol(:,:,1) = uint8(abs(ifft2(ifftshift(spectrum(:,:,1))))); Dol(:,:,2) = uint8(abs(ifft2(ifftshift(spectrum(:,:,2))))); Dol(:,:,3) = uint8(abs(ifft2(ifftshift(spectrum(:,:,3))))); imshow(Dol) whos('Dol') Name Size Bytes Class Attributes Dol 1000x1500x3 36000000 double Dol=uint8(Dol); whos('Dol') Name Size Bytes Class Attributes Dol 1000x1500x3 4500000 uint8 imshow(Dol) width=100; spectrum([1:width end-width:end],:,:)=0; spectrum([1:width end-width:end],:,:)=0; spectrum(:,[1:width end-width:end],:)=0; spy(spectrum(:,:,2)) Dol = uint8(zeros(size(Dolomiti))); Dol(:,:,1) = uint8(abs(ifft2(ifftshift(spectrum(:,:,1))))); Dol(:,:,2) = uint8(abs(ifft2(ifftshift(spectrum(:,:,2))))); Dol(:,:,3) = uint8(abs(ifft2(ifftshift(spectrum(:,:,3))))); imshow(Dolomiti) figure imshow(Dol) width=300; spectrum([1:width end-width:end],:,:)=0; spectrum(:,[1:width end-width:end],:)=0; spy(spectrum(:,:,2)) Dol(:,:,1) = uint8(abs(ifft2(ifftshift(spectrum(:,:,1))))); Dol(:,:,2) = uint8(abs(ifft2(ifftshift(spectrum(:,:,2))))); Dol(:,:,3) = uint8(abs(ifft2(ifftshift(spectrum(:,:,3))))); imshow(Dol) width=400; spectrum([1:width end-width:end],:,:)=0; spectrum(:,[1:width end-width:end],:)=0; spy(spectrum(:,:,2)) Dol(:,:,1) = uint8(abs(ifft2(ifftshift(spectrum(:,:,1))))); Dol(:,:,2) = uint8(abs(ifft2(ifftshift(spectrum(:,:,2))))); Dol(:,:,3) = uint8(abs(ifft2(ifftshift(spectrum(:,:,3))))); imshow(Dol) width=450; spectrum([1:width end-width:end],:,:)=0; spectrum(:,[1:width end-width:end],:)=0; Dol(:,:,1) = uint8(abs(ifft2(ifftshift(spectrum(:,:,1))))); Dol(:,:,2) = uint8(abs(ifft2(ifftshift(spectrum(:,:,2))))); Dol(:,:,3) = uint8(abs(ifft2(ifftshift(spectrum(:,:,3))))); imshow(Dol) Dol = zeros(size(Dolomiti)); Dol(end/2-width:end/2+width, end/2-width:end/2+width, :)=... spectrum(end/2-width:end/2+width, end/2-width:end/2+width, :); whos('Dol') Name Size Bytes Class Attributes Dol 1000x1500x3 72000000 double complex Dol(end/2:end/2+1, end/2:end/2+1, :) ans(:,:,1) = 1.0e+08 * 0.1708 + 0.0391i -0.4575 + 0.2005i -0.0076 - 0.1162i 1.7579 + 0.0000i ans(:,:,2) = 1.0e+08 * 0.0727 + 0.0663i -0.3631 + 0.2973i -0.0017 - 0.0944i 1.7754 + 0.0000i ans(:,:,3) = 1.0e+08 * -0.0244 + 0.0704i -0.2360 + 0.4040i -0.0325 - 0.0140i 1.5912 + 0.0000i Dol(:,:,1) = abs(ifft2(ifftshift(Dol(:,:,1)))); Dol(:,:,2) = abs(ifft2(ifftshift(Dol(:,:,2)))); Dol(:,:,3) = abs(ifft2(ifftshift(Dol(:,:,3)))); whos('Dol') Name Size Bytes Class Attributes Dol 1000x1500x3 36000000 double Dol = uint8(Dol); imshow(Dol) spectrum(end/2-width:end/2+width, end/2-width:end/2+width, :)=0; Dol(:,:,1) = abs(ifft2(ifftshift(Dol(:,:,1)))); Dol(:,:,2) = abs(ifft2(ifftshift(Dol(:,:,2)))); Dol(:,:,1) = abs(ifft2(ifftshift(spectrum(:,:,1)))); Dol(:,:,2) = abs(ifft2(ifftshift(spectrum(:,:,2)))); Dol(:,:,3) = abs(ifft2(ifftshift(spectrum(:,:,3)))); Dol = uint8(Dol); imshow(Dol) Day=imread('DayNight.jpg'); imshow(Day) whos('Day') Name Size Bytes Class Attributes Day 902x1566 1412532 uint8 spectrum = fftshift(fft2(double(Day))); whos('spectrum') Name Size Bytes Class Attributes spectrum 902x1566 22600512 double complex width=400; spectrum([1:width end-width:end],:)=0; spectrum(:,[1:width end-width:end])=0; spy(spectrum) imshow(uint8(abs(ifft2(ifftshift(spectrum))))); width=450; spectrum([1:width end-width:end],:)=0; spectrum(:,[1:width end-width:end])=0; imshow(uint8(abs(ifft2(ifftshift(spectrum))))); clc euler; who Your variables are: Day Dolomiti a b i t width Dol N ans h spectrum u clear all; who euler; who Your variables are: N a b h i t u whos('u') Name Size Bytes Class Attributes u 1x11 88 double euler; plot(t,u) doc ode45 [tm, um] = ode45( @ode1, [0 3], 1 ); hold on plot(tm,um,'r+') plot(tm,um,'w+-') plot(tm,um,'w+-') doc background whitebg(black) {Undefined function or variable 'black'. } whitebg('black') plot(tm,um,'w+-') hold on; plot(t,u) euler ans = 0.0019 euler ans = 7.2724e-04 euler ans = 7.7998e-05 euler ans = 7.8525e-06 euler ans = 7.8578e-07 euler ans = 7.8584e-08 um(end) ans = -0.0378 (um(end) - target)/target ans = -9.0650e-06 [t, u] = eulerF( @ode1, 0, 3, 1, 100 ); plot(t,u) eps ans = 2.2204e-16 lu1(10^-3) ans = 1.0000 0 0.0010 1.0000 lu1(10^-5) ans = 1.0000 0 0.0000 1.0000 format long [L,U] = lu1(10^-5); eps = 10^-7; [L,U] = lu1(eps); norm(L*U-[1 1; eps -1]) ans = 1.1686097e-15 eps = 10^-8; [L,U] = lu1(eps); norm(L*U-[1 1; eps -1]) ans = 6.0774707e-17 eps = 10^-10; [L,U] = lu1(eps); norm(L*U-[1 1; eps -1]) ans = 1.3351432e-18 eps = 10^5; [L,U] = lu1(eps); norm(L*U-[1 1; eps -1]) ans = 0 eps = 10^7; [L,U] = lu1(eps); norm(L*U-[1 1; eps -1]) ans = 0 eps = 10^12; [L,U] = lu1(eps); norm(L*U-[1 1; eps -1]) ans = 4096 eps = 10^8; [L,U] = lu1(eps); norm(L*U-[1 1; eps -1]) ans = 1 eps = 10^10; [L,U] = lu1(eps); norm(L*U-[1 1; eps -1]) ans = 1 L*U ans = 1.0e+10 * 0.0000000 0.0000000 1.0000000 0 format long L*U ans = 1.0e+10 * 0.0000000 0.0000000 1.0000000 0 L*U-[1 1; eps -1] ans = 0 0 0 1 diary