📄 sinecomp.mht
字号:
From: <Saved by Windows Internet Explorer 7>
Subject:
Date: Tue, 12 May 2009 09:41:07 -0700
MIME-Version: 1.0
Content-Type: text/html;
charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable
Content-Location: http://www.mece.ualberta.ca/Courses/mec390/390code/sinecomp.m
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3350
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; =
charset=3Dwindows-1252">
<META content=3D"MSHTML 6.00.6000.16825" name=3DGENERATOR></HEAD>
<BODY><PRE>function sinecomp(n)
%sinecomp(n) where n is the number of terms used in 'mysine'
%this m-file tests the difference between the function =
[x]=3Dmysine(theta,n)
%and the built-in MATLAB function [x]=3Dsin(theta)
t=3D0:pi/100:2*pi;
s=3Dsin(t);
i=3D0;
for t1=3D0:pi/100:2*pi;
i=3Di+1;
ms(i)=3Dmysine(t1,n);
end;
plot(t,s,'b')
%axis tight
hold on
plot(t,ms,'g')
plot(t,(ms-s),'r')
xlabel('Theta, /(radians)')
legend('MATLAB Sin','Mysine','Error')
x=3D[0 2*pi];y=3D[0 0];plot(x,y,'k')
title(['Mysine error check: ' int2str(n) ' terms'])
text(.5,-.5,['max error=3D' num2str(max(abs((ms-s))))])
hold off
</PRE></BODY></HTML>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -