You are on page 1of 3

Name: Kübra 2019/2020 SPRİNG

Surname: ŞEKER

Student ID: 21631263

MMU 218 APPLIED MATHEMATİCS FOR ENGINEERS

HW1

Due Date: 27/04/2020


g) Matlab Code
clc,clear,clear all
syms s
% R = [cos(t), t*sqrt(3) ,sin(t)];
r = [cos(s./2), s.*sqrt(3)*(1/2), sin(s./2)];
r_dot = diff(r,s) % derivative of r(t)
r_ddot = diff(r_dot,s) % derivative of r’(t)
figure(1)
ezplot3(r(1),r(2),r(3),[0,4*pi]) % plot r(t) function
hold on
th = r_dot k=norm(r_ddot) % calculate unit tangent vector
nh = (1/k)*r_ddot bh = cross(th,nh) % calculate normal vector
Th = subs(th, s,pi)
N=subs(nh, s ,pi)
B=subs(bh, s,pi) % calculate binormal vector
% plot unit tangent, normal and binormal vectors
quiver3(0,pi.*sqrt(3)*(1/2),1,Th(:,1),Th(:,2),Th(:,3),'color','r')
quiver3(0,pi.*sqrt(3)*(1/2),1,N(:,1),N(:,2),N(:,3),'color','g')
quiver3(0,pi.*sqrt(3)*(1/2),1,B(:,1),B(:,2),B(:,3),'color','b')

You might also like