Demo entry 6349584

asdf

   

Submitted by anonymous on Feb 21, 2017 at 22:32
Language: Matlab. Code size: 1.0 kB.

%
clear all; close all; clc

t=sqrt(2);
clim = [-2 2]; 
%load the system matrix for these ray paths

G = [1,0,0,1,0,0,1,0,0;
    0,1,0,0,1,0,0,1,0;
    0,0,1,0,0,1,0,0,1;
    1,1,1,0,0,0,0,0,0;
    0,0,0,1,1,1,0,0,0;
    0,0,0,0,0,0,1,1,1;
    t,0,0,0,t,0,0,0,t;
    0,0,0,0,0,0,0,0,t];


mtrue = [-1, 1, -1, 1,-1,1,-1,1,-1]'; %streached out 

% true solution (from your code Obviously); 
figure(1)
colormap('jet')
imagesc(reshape(mtrue,3,3),clim)
H=colorbar;
set(H,'Fontsize',18);
set(gca,'xtick',[1,2,3]);
set(gca,'ytick',[1,2,3]);
xlabel('j')
ylabel('i')



d = G*mtrue; 
[U,S,V] = svd(G); 
p  = 7; 
Up = U(:,1:p);
Vp = V(:,1:p); 
Sp = S(1:p,1:p); 

%mRecovered = Vp*Sp\Up'*d; 
mRecovered = Vp*(Sp^(-1))*Up'*d; 
Mrec_threebythree =reshape(mRecovered,3,3); 
% how well did we find the location of the tumor?
figure(3)
colormap('jet')
imagesc(reshape(mRecovered,3,3),clim)
H=colorbar;
set(H,'Fontsize',18);
set(gca,'xtick',[1,2,3]);
set(gca,'ytick',[1,2,3]);
xlabel('j')
ylabel('i')

This snippet took 0.01 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).