TwoPanelAnimation.m
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%##\ .--. \##\ .-'. \##\ .--. \##\ .--. \##\ .--. \##\ .--. \##\ .`-. \##\.--%%%% %%%%%:::::.\::::::::.\::::::::.\::::::::.\::::::::.\::::::::.\::::::::.\:::::::%%%%% %%%%-' \##\ `--' \##\ `.-' \##\ `--' \##\ `--' \##\ `--' \##\ `-.' \##\ `--' \##%%%% %%%%% \#\ /""7__/""7__/""7__/""7__/""7__/""7__/""7__/""7__/""7__/""7__/""7 \#\ %%%%% %%%%\ .--/""7__/"" /""7__/""7\ .--.%%%% %%%%%:::::/""7__/" 2-D TIME EVOLUTION - DISC - ISENTROPIC \"7__/""7:::::%%%%% %%%%-' \%/""7__/"" TWO PANEL ANIMATION /""7__/""7-' \#\%%%% %%%%%:::::/""7__/" NL SOLUTION & DIFF FROM LINEAR MOD K \"7__/""7:::::%%%%% %%%%\ .--/""7__/"" /""7__/""7\ .--.%%%% %%%%% \#\ /""7__/""7__/""7__/""7__/""7__/""7__/""7__/""7__/""7__/""7__/""7 \#\.%%%%% %%%%##\ .--. \##\ .-'. \##\ .--. \##\ .--. \##\ .--. \##\ .--. \##\ .`-. \##\.--%%%% %%%%%:::::.\::::::::.\::::::::.\::::::::.\::::::::.\::::::::.\::::::::.\:::::::%%%%% %%%%-' \##\ `--' \##\ `.-' \##\ `--' \##\ `--' \##\ `--' \##\ `-.' \##\ `--' \##%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % This script assumes that in the current workspace, there are the results % of a previously run computation. Namely, the workspace should contain % pNLMatrix, the matrix of p(x,t) values, at each timestep, for each % iteration. % With this in the workspace, this script creates an animation consisting % of two panels: % (1) the i_th iterated solution p^{(i)}(x,t) % (2) the difference of p^{(i)}(x,t) and the linear evolution of % p^{(i)}(x,0), projected away from the k-mode % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % Create a figure + create Cartesian axes from our polar axes set(0,'DefaultFigureWindowStyle','docked') [thetaMeshGridPlot,rMeshGridPlot] = meshgrid(thetaGridFull,rGrid); figTemp3 = figure % Prompt the user for which iterated solution to use prompt = ['Specify which iterated solution to create an animation from. That is, make a choice of i to create an animation from the i_th iterated solution p^{(i)}(x,t): ']; iterationStep = input([prompt,newline]); % Create a VideoWriter that we will write frame by frame to v3 = VideoWriter('Mar_23_2026_K42Alpha0075_Step5_TwoPanel.mp4', 'MPEG-4'); open(v3); digits(4) % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % For pert_Theta_Index > 1, all calculations in the course of the iteration % take palce on the wedge 0 < theta < 2pi/pert_Theta_Index rather than the % whole disk % So, for plotting, we create another version of p_NL_Matrix that is % defined on the whole disc [which is done by just translating the wedge] pNLMatrixFullInt = zeros(length(thetaGridFull),rPoints,timePoints); pNLMatrixFullStep = zeros(length(thetaGridFull),rPoints,timePoints); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% for l2 = 1:timePoints %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % for j1 = 1:pertThetaIndex % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% for j2 = 1:length(thetaGrid) %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% pNLMatrixFullInt((j1-1)*thetaPoints+j2,[1:rPoints],l2) = pNLMatrix(j2,[1:rPoints],l2,1); pNLMatrixFullStep((j1-1)*thetaPoints+j2,[1:rPoints],l2) = pNLMatrix(j2,[1:rPoints],l2,iterationStep); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% end %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % end % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% end %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% pEigenFncPertFull = zeros(thetaPointsFull,rPoints); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% for j1 = 1:pertThetaIndex %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % for j2 = 1:length(thetaGrid) % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % pEigenFncPertFull((j1-1)*thetaPoints+j2,1:rPoints) = pEigenFncPertTemp(j2,1:rPoints); % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % end % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% end %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % The second panel in this animation is the difference between % p^{(i)}(x,t) and the linear evolution of p^{(i)}(x,0), minus k-modes % Linear evolution looks like a simple rotation, namely, with U(x,0) = 0 % and thus U_j(0) = 0 for all j, the j-components of P and U are given by % P_j(t) = cos(lambda_j * t) * P_j(0) % U_j(t) = sin(lambda_j * t) * P_j(0) % So, at each timestep, we compute the linear evolution of each % p^{(i)}_j(0) up to the current timestep, say t*, recompose to find the % matrix of values of the linear evolution, and then find the difference % between that and p^{(i)}(x,t*) [taking out all k-mode components] linearSolutionSlice(:,:)=zeros(thetaPointsFull,rPoints); nonlinearSolutionSlice(:,:)=zeros(thetaPointsFull,rPoints); nonlinearDiffFromLinearDataEvo(:,:)=zeros(thetaPointsFull,rPoints); pEigenFncLoop = zeros(thetaPointsFull,rPoints); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% for n = 1:thetaBasisSize %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % for m = 1:rBasisSize % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % if n == 2 && m == pertRIndex continue end pEigenFncLoop(:,:) = p_EigenFnc_FullDisc(n,m,:,:); linearSolutionSlice(:,:) = linearSolutionSlice(:,:) + pNLDecompMatrix(n,m,1,iterationStep) * pEigenFncLoop(:,:); % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % end % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% end %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% nonlinearSolutionSlice(:,:) = pNLMatrixFullStep(:,:,1); nonlinearDiffFromLinearDataEvo(:,:) = pStepMinusKFull(:,:,1) - linearSolutionSlice(:,:); fractionArray = linspace(0,1,timePoints); % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % s1 = subplot(1,2,1); mesh(rMeshGridPlot.*cos(thetaMeshGridPlot),rMeshGridPlot.*sin(thetaMeshGridPlot),transpose(nonlinearSolutionSlice)); axis manual axis([-1 1 -1 1 100400 102200]) view(-25,22); title(['Nonlinear evolution of $p^{(5)}(x,t)$'],'Interpreter','latex','FontSize',9.5 ); xlabel(['$\bar{p}=',num2str(pBar),',\:\:\: \alpha \bar{p} = ',num2str(perturbationCoeff),',\:\:\: T=\frac{\pi}{\lambda_{4,2}}=$',num2str(timePeriod)],'Interpreter','latex','FontSize',10); s2 = subplot(1,2,2); mesh(rMeshGridPlot.*cos(thetaMeshGridPlot),rMeshGridPlot.*sin(thetaMeshGridPlot),transpose(nonlinearDiffFromLinearDataEvo)); axis manual axis([-1 1 -1 1 -30 25]) view(-25,22); title(['Difference between $p^{(5)}(x,t)$ and the linear evolution of the same initial data'],'Interpreter','latex','FontSize',9.5 ); %xlabel(['$\bar{p}=',num2str(pBar),', \alpha \bar{p} = ',num2str(perturbationCoeff),', T=\frac{\pi}{\lambda_{4,2}}=$',num2str(timePeriod)],'Interpreter','latex','FontSize',10); text(1.2,-1.2,0,['$t=0 \cdot T$'],'Interpreter','latex','BackgroundColor','white','FontSize',12,'FontWeight','bold','Color','black') xlabel(['$\:\:\: p^{(0)}(x,0) = \bar{p} + \alpha \bar{p} \frac{\phi_{4,2}(x)}{\bar{\sigma}} = \bar{p} + \alpha \bar{p} \cos(4\theta) J_4(\lambda_{4,2}\bar{\sigma}r)$'],'Interpreter','latex','FontSize',10); frameTemp = getframe(figTemp3); %frameTemp = getframe(figTemp3); writeVideo(v3,frameTemp); writeVideo(v3,frameTemp); writeVideo(v3,frameTemp); % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% for l = 2:timePoints %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% pEigenFncLoop = zeros(thetaPointsFull,rPoints); linearSolutionSlice(:,:)=zeros(thetaPointsFull,rPoints); % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % for n = 1:thetaBasisSize % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% for m = 1:rBasisSize %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% if n == 2 && m == pertRIndex continue end pEigenFncLoop(:,:) = p_EigenFnc_FullDisc(n,m,:,:); linearSolutionSlice(:,:) = linearSolutionSlice(:,:) + pNLDecompMatrix(n,m,l,iterationStep) * pEigenFncLoop(:,:) * cos(eigenFreqMatrix(n,m)*timeGrid(l)); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% end %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % end % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % nonlinearSolutionSlice(:,:) = pNLMatrixFullStep(:,:,l); nonlinearDiffFromLinearDataEvo(:,:) = pStepMinusKFull(:,:,l) - linearSolutionSlice(:,:); s1 = subplot(1,2,1); mesh(rMeshGridPlot.*cos(thetaMeshGridPlot),rMeshGridPlot.*sin(thetaMeshGridPlot),transpose(nonlinearSolutionSlice)); axis manual axis([-1 1 -1 1 100400 102200]) view(-25,22); title(['Nonlinear evolution of $p^{(5)}(x,t)$'],'Interpreter','latex','FontSize',9.5 ); xlabel(['$\bar{p}=',num2str(pBar),',\:\:\: \alpha \bar{p} = ',num2str(perturbationCoeff),',\:\:\: T=\frac{\pi}{\lambda_{4,2}}=$',num2str(timePeriod)],'Interpreter','latex','FontSize',10); s2 = subplot(1,2,2); mesh(rMeshGridPlot.*cos(thetaMeshGridPlot),rMeshGridPlot.*sin(thetaMeshGridPlot),transpose(nonlinearDiffFromLinearDataEvo)); axis manual axis([-1 1 -1 1 -30 25]) view(-25,22); title(['Difference between $p^{(5)}(x,t)$ and the linear evolution of the same initial data'],'Interpreter','latex','FontSize',9.5 ); text(1.2,-1.2,0,['$t=$',num2str(double(vpa(fractionArray(l)))),'$\cdot T$'],'Interpreter','latex','BackgroundColor','white','FontSize',12,'FontWeight','bold','Color','black') xlabel(['$\:\:\: p^{(0)}(x,0) = \bar{p} + \alpha \bar{p} \frac{\phi_{4,2}(x)}{\bar{\sigma}} = \bar{p} + \alpha \bar{p} \cos(4\theta) J_4(\lambda_{4,2}\bar{\sigma}r)$'],'Interpreter','latex','FontSize',10); frameTemp = getframe(figTemp3); %frameTemp = getframe(figTemp3); writeVideo(v3,frameTemp); writeVideo(v3,frameTemp); writeVideo(v3,frameTemp); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% end %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% for l = 1:timePoints-2 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% pEigenFncLoop = zeros(thetaPointsFull,rPoints); linearSolutionSlice(:,:)=zeros(thetaPointsFull,rPoints); % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % for n = 1:thetaBasisSize % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% for m = 1:rBasisSize %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% if n == 2 && m == pertRIndex continue end pEigenFncLoop(:,:) = p_EigenFnc_FullDisc(n,m,:,:); linearSolutionSlice(:,:) = linearSolutionSlice(:,:) + pNLDecompMatrix(n,m,timePoints-l,iterationStep) * pEigenFncLoop(:,:) * cos(eigenFreqMatrix(n,m)*(timePeriod+timeGrid(l+1))); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% end %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % end % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % nonlinearSolutionSlice(:,:) = pNLMatrixFullStep(:,:,timePoints-l); nonlinearDiffFromLinearDataEvo(:,:) = pStepMinusKFull(:,:,timePoints-l) - linearSolutionSlice(:,:); s1 = subplot(1,2,1); mesh(rMeshGridPlot.*cos(thetaMeshGridPlot),rMeshGridPlot.*sin(thetaMeshGridPlot),transpose(nonlinearSolutionSlice)); axis manual axis([-1 1 -1 1 100400 102200]) view(-25,22); title(['Nonlinear evolution of $p^{(5)}(x,t)$'],'Interpreter','latex','FontSize',9.5 ); xlabel(['$\bar{p}=',num2str(pBar),',\:\:\: \alpha \bar{p} = ',num2str(perturbationCoeff),',\:\:\: T=\frac{\pi}{\lambda_{4,2}}=$',num2str(timePeriod)],'Interpreter','latex','FontSize',10); s2 = subplot(1,2,2); mesh(rMeshGridPlot.*cos(thetaMeshGridPlot),rMeshGridPlot.*sin(thetaMeshGridPlot),transpose(nonlinearDiffFromLinearDataEvo)); axis manual axis([-1 1 -1 1 -30 25]) view(-25,22); title(['Difference between $p^{(5)}(x,t)$ and the linear evolution of the same initial data'],'Interpreter','latex','FontSize',9.5 ); text(1.2,-1.2,0,['$t=$',num2str(double(vpa(1.0000+fractionArray(l)))),'$\cdot T$'],'Interpreter','latex','BackgroundColor','white','FontSize',12,'FontWeight','bold','Color','black') xlabel(['$\:\:\: p^{(0)}(x,0) = \bar{p} + \alpha \bar{p} \frac{\phi_{4,2}(x)}{\bar{\sigma}} = \bar{p} + \alpha \bar{p} \cos(4\theta) J_4(\lambda_{4,2}\bar{\sigma}r)$'],'Interpreter','latex','FontSize',10); frameTemp = getframe(figTemp3); %frameTemp = getframe(figTemp3); writeVideo(v3,frameTemp); writeVideo(v3,frameTemp); writeVideo(v3,frameTemp); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% end %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% close(v3) digits(32) % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %