-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathspatial_eigen.m
More file actions
32 lines (23 loc) · 879 Bytes
/
spatial_eigen.m
File metadata and controls
32 lines (23 loc) · 879 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
function [eigenf, eigenv, surfa]=spatial_eigen(file,eigN)
%use FEM function and read_surf
%define struct
surfa=struct('vertices',1,'faces',1);
%store surface vertices and faces from freesurfer objects
[surfa.vertices, surfa.faces]=read_surf(file);
%correct faces index from 1 instead of from 0
surfa.faces=surfa.faces+1;
%correct surface value needed to compute FEM
surfa.vertices(1,:) = 1.*surfa.vertices(1,:) + 1e-6;
% normalisation
area = calc_surf_area(surfa)
%norm= sqrt(area/0.0609)/1000
%surfa.vertices = surfa.vertices/sqrt(area/0.0609); % to get a sphere with same surface
%surfa.vertices = surfa.vertices/100; %cortex
% area = calc_surf_area(surfa)
%find solutions of Helmholtz eq
[A,C] = FEM(surfa);
%compute eigenfunctions and eigenvalues
[eigenf,eigenv] = eigs(C,A,eigN,'sm');
%eigenv %display k^2
eigenv=sqrt(eigenv); %to get k and not k^2 (optional)
end