% % @file pde1d.m % % @brief % % @copyright % Copyright (©) 2021 EPFL (Ecole Polytechnique Fédérale de Lausanne) % SPC (Swiss Plasma Center) % % SPClibs is free software: you can redistribute it and/or modify it under % the terms of the GNU Lesser General Public License as published by the Free % Software Foundation, either version 3 of the License, or (at your option) % any later version. % % SPClibs is distributed in the hope that it will be useful, but WITHOUT ANY % WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS % FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. % % You should have received a copy of the GNU Lesser General Public License % along with this program. If not, see . % % @authors % (in alphabetical order) % @author Trach-Minh Tran % file='pde1d.h5'; fprintf(1,'NX = %d\n', hdf5read(file,'/NX')); fprintf(1,'NIDBAS = %d\n', hdf5read(file,'/NIDBAS')); fprintf(1,'NGAUSS = %d\n', hdf5read(file,'/NGAUSS')); fprintf(1,'KDIFF = %d\n', hdf5read(file,'/KDIFF')); x = hdf5read(file, '/XGRID'); f= hdf5read(file, '/SOLCAL'); fexact= hdf5read(file, '/SOLANA'); err=hdf5read(file, '/ERR'); f=f'; fexact=fexact'; err=err'; figure subplot(311) plot(x,f(1,:),'o',x,fexact(1,:)) xlabel('X') ylabel('Function') grid on subplot(312) plot(x,f(2,:),'o',x,fexact(2,:)) xlabel('X') ylabel('1st Derivative') grid on subplot(313) plot(x,f(3,:),'o',x,fexact(3,:)) xlabel('X') ylabel('2nd Derivative') grid on figure subplot(311) plot(x,err(1,:),'o-') xlabel('X'); ylabel('Errors on function'); grid on subplot(312) plot(x,err(2,:),'o-') xlabel('X'); ylabel('Errors on 1st derivative'); grid on subplot(313) plot(x,err(3,:),'o-') xlabel('X'); ylabel('Errors on 2nd derivative'); grid on