0% found this document useful (0 votes)
10 views3 pages

Sinaise Sistemas Semanadois

The document outlines a MATLAB script that performs various mathematical operations, including plotting individual functions and their combined form based on arbitrary constants. It calculates the dot product of two functions and computes the Taylor series expansion of a cosine function. The results are visualized through multiple plots to illustrate the functions and their approximations.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
10 views3 pages

Sinaise Sistemas Semanadois

The document outlines a MATLAB script that performs various mathematical operations, including plotting individual functions and their combined form based on arbitrary constants. It calculates the dot product of two functions and computes the Taylor series expansion of a cosine function. The results are visualized through multiple plots to illustrate the functions and their approximations.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

% Part 1 using arbitrary values for constants

a = 1; % Value for a
b = 2; % Value for b
c = 10; % Value for c

% Range for t
t = linspace(-1, 1, 100); % 100 points between -1 and 1

% Calculate the functions


y1 = a * t.^2; % a*t^2
y2 = b * t; % b*t
y3 = c; % c (constant)

% The combined function


y_combined = a * t.^2 + b * t + c;

% Individual functions
figure;
hold on; % Hold on to plot multiple graphs
plot(t, y1, 'r', 'DisplayName', 'a*t^2'); % Plot a*t^2 in red
plot(t, y2, 'g', 'DisplayName', 'b*t'); % Plot b*t in green
plot(t, y3 * ones(size(t)), 'b', 'DisplayName', 'c'); % Plot c in blue
title('Individual Functions');
xlabel('t');
ylabel('Value');
ylim([-5 15]);
legend show;
grid on; % Add grid for better visualization
hold off; % Release the hold

% Combined function
figure;
plot(t, y_combined, 'Color', [0.5, 0, 0.5], 'DisplayName', 'a*t^2 + b*t + c'); %
Combined function in dashed black
title('Combined Function: a*t^2 + b*t + c');
xlabel('t');
ylabel('Value');
legend show;
grid on; % Add grid for better visualization

1
%Part 2

% The variable (t) still has the same range, so no changes

% The functions
g = 5 + t.^2 + 2*t + 9; % g(t)
h = sin(2*t) .* log(5 + 3*t); % h(t)

% The dot product


dot_product = dot(g, h); % Using the dot function

% Display the result


disp(['The dot product of g(t) and h(t) is: ', num2str(dot_product)]);

The dot product of g(t) and h(t) is: 546.5118

% Part 3

% Define the symbolic variable


syms T;

% Define the function


x = cos(10 * pi * T);

% Compute the Taylor series expansion up to the 4th order (5 terms)


taylor_series = taylor(x, T, 'Order', 5);

% Create a range of t values for plotting


T_values = linspace(-0.2, 0.2, 100); % 100 points between -1 and 1

% Evaluate the original function and the Taylor series at these points
x_values = double(subs(x, T, T_values));
taylor_values = double(subs(taylor_series, T, T_values));

% Plot the original function and the Taylor series


figure;
plot(T_values, x_values, 'b', 'DisplayName', 'cos(10\pi t)'); % Original function
in blue
title('cos(10\pi t)');

2
xlabel('t');
ylabel('Function Value');
ylim([-1 3]);
legend show;
grid on;

figure;
plot(T_values, taylor_values, 'r', 'DisplayName', 'Taylor Series (5 terms)'); %
Taylor series in red dashed line
title('Taylor Series Approximation of cos(10\pi t)');
xlabel('T');
ylabel('Function Value');
ylim([-1 3]);
legend show;
grid on;

You might also like