A community for students.
Here's the question you clicked on:
 0 viewing
mukushla
 3 years ago
write a mfile with matlab which takes a and n from user and gives the n term s of taylor series of sin(x) around x=a
mukushla
 3 years ago
write a mfile with matlab which takes a and n from user and gives the n term s of taylor series of sin(x) around x=a

This Question is Closed

mukushla
 3 years ago
Best ResponseYou've already chosen the best response.0i have difficulties with math part @experimentX

mukushla
 3 years ago
Best ResponseYou've already chosen the best response.0we must print something like this\[a_0+a_1(xa)+a_2(xa)^2+...\]

experimentX
 3 years ago
Best ResponseYou've already chosen the best response.0Woops ... !! probably write a function do do that.

experimentX
 3 years ago
Best ResponseYou've already chosen the best response.0syms x diff(sin(x), 'n times differentiate', 'around a');

mukushla
 3 years ago
Best ResponseYou've already chosen the best response.0man would u mind to join us :)

mukushla
 3 years ago
Best ResponseYou've already chosen the best response.0nth derivative of sin(x)\[\sin(\frac{n\pi}{2}+x)\]

experimentX
 3 years ago
Best ResponseYou've already chosen the best response.0Woops ... i need to differentiate it and substitute it.

experimentX
 3 years ago
Best ResponseYou've already chosen the best response.0clc syms x center = input('Enter the center of expansion: '); for i=1:10 disp(subs(diff(sin(x), i), x, center)); end

mukushla
 3 years ago
Best ResponseYou've already chosen the best response.0exper can we show that like what i mentioned above?

mukushla
 3 years ago
Best ResponseYou've already chosen the best response.0for example with center 3 0.99000.1411(x3)+0.9900(x3)^2+...

experimentX
 3 years ago
Best ResponseYou've already chosen the best response.0hold on ... I'm working.

experimentX
 3 years ago
Best ResponseYou've already chosen the best response.0I don't like Matlab's string handing !!

phi
 3 years ago
Best ResponseYou've already chosen the best response.1This does not do the input. But it does give an idea a=pi/3, n=4; str2=''; for ii=0:(n1) switch mod(ii,4) case 0, ff= sin(a); case 1, ff= cos(a); case 2, ff= sin(a); case 3, ff= cos(a); end; if (ff<0) sg= '' else sg= '+'; end; if ii>0 str= sprintf('%2s %7.5f(x%2.4f)^%d',sg, abs(ff)/factorial(ii),a,ii); else str= sprintf('%7.5f',ff); end; str2= [str2 str]; end; str2

phi
 3 years ago
Best ResponseYou've already chosen the best response.1its output str2 = 0.86603 + 0.50000(x1.0472)^1  0.43301(x1.0472)^2  0.08333(x1.0472)^3

experimentX
 3 years ago
Best ResponseYou've already chosen the best response.0I really hate matlab for string manipulation clc syms x center = input('Enter the center of expansion: '); for i=1:3 disp( [subs(diff(sin(x), i), x, center), strcat('(x', num2str(center), ')^', num2str(i))]); end

experimentX
 3 years ago
Best ResponseYou've already chosen the best response.0I got this nasty code ... looks pretty close clc syms x center = input('Enter the center of expansion: '); to_out = ''; for i=1:10 to_out = strcat(to_out, '+' , strcat(char(subs(diff(sin(x), i), x, center)), strcat('(x', num2str(center), ')^', num2str(i)))); end disp(to_out);

experimentX
 3 years ago
Best ResponseYou've already chosen the best response.0the out put is ...for r=4 ... maybe tweak a little. +cos(3)(x3)^1+sin(3)(x3)^2+cos(3)(x3)^3+sin(3)(x3)^4
Ask your own question
Sign UpFind more explanations on OpenStudy
Your question is ready. Sign up for free to start getting answers.
spraguer
(Moderator)
5
→ View Detailed Profile
is replying to Can someone tell me what button the professor is hitting...
23
 Teamwork 19 Teammate
 Problem Solving 19 Hero
 Engagement 19 Mad Hatter
 You have blocked this person.
 ✔ You're a fan Checking fan status...
Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.