Question

PLEASE USE MATLAB

this problem you are trying to find an approximation to the periodic function /(t) esint-1) over one period, o <t < 2π. In t-

0 0
Add a comment Improve this question Transcribed image text
Answer #1

MATLAB Code:

close all
clear
clc

t = linspace(0, 2*pi, 200)';
b = exp(sin(t-1));

fprintf('Part (a)\n-----------------------------------------------\n')
T = [ones(size(t)) t t.^2 t.^3 t.^4 t.^5 t.^6 t.^7];
CA = T\b;
fprintf('f(t) ~ %f + %f*t + %f*t^2 + %f*t^3 + %f*t^4 + %f*t^5 + %f*t^6 + %f*t^7\n', CA)

fprintf('\nPart (b)\n-----------------------------------------------\n')
T = [ones(size(t)) cos(t) sin(t) cos(2*t) sin(2*t)];
CB = T\b;
fprintf('f(t) ~ %f + %f*cos(t) + %f*sin(t) + %f*cos(2*t) + %f*sin(2*t)\n', CB)

plot(t, b), hold on
plot(t, CA(1) + CA(2)*t + CA(3)*t.^2 + CA(4)*t.^3 + CA(5)*t.^4 + CA(6)*t.^5 + CA(7)*t.^6 + CA(8)*t.^7)
plot(t, CB(1) + CB(2)*cos(t) + CB(3)*sin(t) + CB(4)*cos(2*t) + CB(5)*sin(2*t))
xlabel('t'), ylabel('f(t)')
legend('Original Function', 'Part (a)', 'Part (b)')

Output:

Part (a)
-----------------------------------------------
f(t) ~ 0.326349 + 1.644306*t + -3.880251*t^2 + 4.701695*t^3 + -2.320595*t^4 + 0.540292*t^5 + -0.060086*t^6 + 0.002586*t^7

Part (b)
-----------------------------------------------
f(t) ~ 1.266081 + -0.951099*cos(t) + 0.610714*sin(t) + 0.113013*cos(2*t) + -0.246870*sin(2*t)

Plot:

Original Function -Part (a) Part (b) 2.5 2 ︵ 1.5 0.5 7 6 5 4 2 0

Add a comment
Know the answer?
Add Answer to:
PLEASE USE MATLAB this problem you are trying to find an approximation to the periodic function /(t) esint-1) over one period, o <t < 2π. In t-linspace(0,2*pi,200)' and let b be a column ve...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT