Demo entry 6338626

Some Code

   

Submitted by anonymous on Dec 14, 2016 at 15:33
Language: Matlab. Code size: 1.9 kB.

close all;

v = 0.1; %define poisson ratio
phi = (1-v)/16;

koin = 1.5;
ko = koin/sqrt(phi); % define formula for ko kt = -40:0.01:20; %range for kt

komat(1,1:length(kt)) = ko; % for the graphing of ko r = zeros(length(kt),3);

for e=1:1:length(kt)
     disc(e) = -4*phi*(0.5*phi+1)^3 - 27*phi*phi*(ko+kt(e))^2 ; end
max(disc) %check maximum discriminant is under 0, so only one real root

for h=1:1:length(kt)
     r(h,:) = roots([phi 0 (phi/2)+1 -(ko+kt(h))]); %find roots of du/dk = 0 end

sel = r == real(r);
r = r(sel); %selects only the real roots of r

for g=1:1:length(r)
     drdk(g) = 2 + 0.5*phi*(12*r(g)*r(g)-2*ko*ko); %finds d2u/dk2 for each solution of k end

s = zeros(1,length(r));
t = zeros(1,length(r));

for i=1:1:length(r)
     if drdk(i)<0
         s(i) = NaN;
         t(i) = r(i);
     else
         s(i) = r(i);
         t(i) = NaN;     %Seperates the stable from unstable part of the
graph
     end
end

figure('Position',[50,100,700,500])  %Plots the graphs
plot(s,kt,'b-','LineWidth',3,komat,kt,'g-','LineWidth',3,t,kt,'r-','LineWidth',3)

title('Curvature of a bimetallic cap when heated','FontSize',12,'FontWeight','Bold');
xlabel('Dimensionless Curvature','FontSize',12); ylabel('Dimensionless Free Curvature, \kappa_T a^{2} / t','FontSize',12); legend('Final Curvature, \kappa a^{2} / t','Initial Curvature, \kappa_0
a^2 / t','Unstable Region','location','eastoutside');
text(12,-25,{strcat('\nu =  ', num2str(v)),strcat('\kappa_{0} = ', num2str(koin), '/ \phi^{0.5}'),''},'FontSize',12) grid on;

hold on;

figure('Position',[800,100,500,450])
plot(r,drdk,'LineWidth',3)
title('Stability of solutions','FontSize',12,'FontWeight','Bold');
xlabel('Dimensionless Final Curvature, \kappa a^{2} / t','FontSize',12); ylabel('\partial^{2}U / \partial\kappa^{2} ','FontSize',12); grid on;

This snippet took 0.01 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).