Question: I have written a function on MATLAB for calculating the gamma or LF of velocity in m/s (gamma(y) against velocity(v)). I am having trouble plotting
I have written a function on MATLAB for calculating the gamma or LF of velocity in m/s (gamma(y) against velocity(v)). I am having trouble plotting and adding Taylor expansion to my current function as it doesn't recognize the T6 at all. I am to plot this Taylor expansion (shown in the picture) and add it to my plot from this:Please explain how and show me using MATLAB. Current code:
function [y,v] = Gamma_Function(v)
%Inputs the velocity (v)
%Outputs the Lorentz Factor
c = 299792458; %Speed of light (m/s)
y = ((1)./(sqrt(1-((v.^2)/(c^2))))); %Lorentz factor equation
end
%Plotting LF
%define v and y
v = [1:100000:299792458,299792458]; %define velocity
[y] = Gamma_Function(v); %calls function
%plots function
plot(v,y)
xlabel ('Velocity')
ylabel ('Gamma')
title ('Lorentz Factor')
grid on
What I've tried: syms v c y = 1/sqrt(1-((v*c)^2/c^2)); T6 = Taylor(y, v); T8 = Taylor(y, v, 'Order', 8); T10 = Taylor(y, v, 'Order', 10); fplot([T6 T8 T10 y]) xlim([0 1]) grid on legend('approximation of y up to O(x^6)',... 'approximation of y up to O(x^8)',... 'approximation of y up to O(x^{10})',... 'y','Location','Best') title('Taylor Series Expansion')Taylor Series Expansion : Lesen (16-a)" = f(a+ fps (x -a) = cream ( x -abercrom (8.a)?-- * (x-a) * # *** + tha) (x-ala LF.: Hla) VI-821 = (1672 r(a) = 2(0)+ ax'(0)+ 0/01 + $0 "(0)+ - First Termi r(0) = (1-02) Second Term: (all-a ar'(o) = a ar'(o) = 0 Result: g= 1+{a?+a" tag 6 at a + u as Taylor Series Expansion : Lesen (16-a)" = f(a+ fps (x -a) = cream ( x -abercrom (8.a)?-- * (x-a) * # *** + tha) (x-ala LF.: Hla) VI-821 = (1672 r(a) = 2(0)+ ax'(0)+ 0/01 + $0 "(0)+ - First Termi r(0) = (1-02) Second Term: (all-a ar'(o) = a ar'(o) = 0 Result: g= 1+{a?+a" tag 6 at a + u as
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts

Please explain how and show me using MATLAB. Current code: