Skip to content

Instantly share code, notes, and snippets.

View Atreyagaurav's full-sized avatar
💭
I have so much to learn there is no time for studying.

Zero Atreyagaurav

💭
I have so much to learn there is no time for studying.
  • University of Cincinnati
  • Cincinnati, Ohio
View GitHub Profile
@Atreyagaurav
Atreyagaurav / ConjugateGradient
Created July 14, 2019 15:22
Matlab script for solving linear equations by conjugate gradient method.
function f=sol(a,x,b)
%conjugate gradient method
g=a*x-b;
d=-g;
while(1):
alpha=(g'*g)/(d'*a*d);
x=x+alpha*d
beta=g'*g;
g=g+alpha*a*d;
beta=g'*g/beta;
@Atreyagaurav
Atreyagaurav / tacheometry.m
Created July 14, 2019 15:09
It calculates the tacheometric readings for survey from known points. so you can reverse engineer the data.
function f = tach(l,m,n,x,y,z,h)
%this function gives you the horizontal angle, stadia reading and vertical angle for
%tacheometry
% input as (x-of stn,y of stn,z of stn,x,y,z of point,HI)
hz=sqrt((l-x)^2+(m-y)^2);
op=1:6;
alpha=radtodeg(atan((x-l)/(y-n)));
if ((x-l)<0 & (y-m)>0)
alpha=alpha+360;