%%%%%%%%%%%%%%%%%%%%%%%%%%
%   yl1_pp.m   pinge punktis

clear
clc
delete yl1_pp.txt
clc
echo on
diary yl1_pp.txt

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%pingetensor
syms x y z
S=[3*x*y 5*y^2 0; 5*y^2 0 2*z; 0 2*z 0]

%silinder y^2+z^2-4=0
phi= y^2+z^2-4

% SILINDRI KÜLGPIND
% pinnanormaal:

nu=[diff(phi,x),diff(phi,y),diff(phi,z)]

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Punkt P

x=2,y=1,z=sqrt(3)
% pingetensor
SP=subs(S), 
% pinnanormaal
nuP=subs(nu),
% ühiknormaal
nuP=nuP/norm(nuP)
% pingevektor
p=(nuP*SP)
% pingevektori moodul
pm=norm(p)
% pingevektori proj. normaalil
sigma=p*nuP'
% nihkepinge moodul
tau = sqrt(pm^2-sigma^2)
% nihkepinge sihiline ühikvektor
nuPp=cross(nuP,p);
tv=cross(nuPp,nuP)/norm(nuPp)
% nihkepinge vektor
tauv=tau*tv

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Punkt Q

x=0,y=1,z=sqrt(3)
% pingetensor
SP=subs(S), 
% pinnanormaal
nuP=subs(nu),
% ühiknormaal
nuP=nuP/norm(nuP)
% pingevektor
p=(nuP*SP)
% pingevektori moodul
pm=norm(p)
% pingevektori proj. normaalil
sigma=p*nuP'
% nihkepinge moodul
tau = sqrt(pm^2-sigma^2)
% nihkepinge sihiline ühikvektor
nuPp=cross(nuP,p);
tv=cross(nuPp,nuP)/norm(nuPp)
% nihkepinge vektor
tauv=tau*tv

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Punkt R

x=4,y=1,z=sqrt(3)
% pingetensor
SP=subs(S), 
% pinnanormaal
nuP=subs(nu),
% ühiknormaal
nuP=nuP/norm(nuP)
% pingevektor
p=(nuP*SP)
% pingevektori moodul
pm=norm(p)
% pingevektori proj. normaalil
sigma=p*nuP'
% nihkepinge moodul
tau = sqrt(pm^2-sigma^2)
% nihkepinge sihiline ühikvektor
nuPp=cross(nuP,p);
tv=cross(nuPp,nuP)/norm(nuPp)
% nihkepinge vektor
tauv=tau*tv

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Punkt L

x=2,y=2,z=0
% pingetensor
SP=subs(S), 
% pinnanormaal
nuP=subs(nu),
% ühiknormaal
nuP=nuP/norm(nuP)
% pingevektor
p=(nuP*SP)
% pingevektori moodul
pm=norm(p)
% pingevektori proj. normaalil
sigma=p*nuP'
% nihkepinge moodul
tau = sqrt(pm^2-sigma^2)
% nihkepinge sihiline ühikvektor
nuPp=cross(nuP,p);
tv=cross(nuPp,nuP)/norm(nuPp)
% nihkepinge vektor
tauv=tau*tv

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Punkt M

x=2,y=0,z=2
% pingetensor
SP=subs(S), 
% pinnanormaal
nuP=subs(nu),
% ühiknormaal
nuP=nuP/norm(nuP)
% pingevektor
p=(nuP*SP)
% pingevektori moodul
pm=norm(p)
% pingevektori proj. normaalil
sigma=p*nuP'
% nihkepinge moodul
tau = sqrt(pm^2-sigma^2)
% nihkepinge sihiline ühikvektor
nuPp=cross(nuP,p);
tv=cross(nuPp,nuP)/norm(nuPp)
% nihkepinge vektor
tauv=tau*tv

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% OTSPIND x=0

% otspinna ühiknormaal
nuP=[-1,0,0]
% pinge melevaldses punktis
pmp=(nuP*S).'
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Punkt Q

x=0,y=1,z=sqrt(3)
% pingetensor
SP=subs(S), 
% pingevektor
p=(nuP*SP)
% pingevektori moodul
pm=norm(p)
% pingevektori proj. normaalil
sigma=p*nuP'
% nihkepinge moodul
tau = sqrt(pm^2-sigma^2)
% nihkepinge sihiline ühikvektor
nuPp=cross(nuP,p);
tv=cross(nuPp,nuP)/norm(nuPp)

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% OTSPIND x=4

% otspinna ühiknormaal
nuP=[1,0,0]
% pinge melevaldses punktis
pmp=(nuP*S).'

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Punkt P

x=4,y=1,z=sqrt(3)
% pingetensor
SP=subs(S), 
% pingevektor
p=(nuP*SP)
% pingevektori moodul
pm=norm(p)
% pingevektori proj. normaalil
sigma=p*nuP'
% nihkepinge moodul
tau = sqrt(pm^2-sigma^2)
% nihkepinge sihiline ühikvektor
nuPp=cross(nuP,p);
tv=cross(nuPp,nuP)/norm(nuPp)


%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%Pinge silindrilise pinna meelevaldses punktis
syms x y z
% 1. sil. pinna normaal
nu
% 2. sil. pinna ühiknormaal
nuno=sqrt(4*y^2+4*z^2)
nuy=nu/nuno
% pinge meelevaldses punktis
pmp=((nuy*S).')

echo off

diary off


