欢迎来到淘文阁 - 分享文档赚钱的网站! | 帮助中心 好文档才是您的得力助手!
淘文阁 - 分享文档赚钱的网站
全部分类
  • 研究报告>
  • 管理文献>
  • 标准材料>
  • 技术资料>
  • 教育专区>
  • 应用文书>
  • 生活休闲>
  • 考试试题>
  • pptx模板>
  • 工商注册>
  • 期刊短文>
  • 图片设计>
  • ImageVerifierCode 换一换

    科学计算科学计算 (29).pdf

    • 资源ID:67731183       资源大小:518.34KB        全文页数:20页
    • 资源格式: PDF        下载积分:8金币
    快捷下载 游客一键下载
    会员登录下载
    微信登录下载
    三方登录下载: 微信开放平台登录   QQ登录  
    二维码
    微信扫一扫登录
    下载资源需要8金币
    邮箱/手机:
    温馨提示:
    快捷下载时,用户名和密码都是您填写的邮箱或者手机号,方便查询和重复下载(系统自动生成)。
    如填写123,账号就是123,密码也是123。
    支付方式: 支付宝    微信支付   
    验证码:   换一换

     
    账号:
    密码:
    验证码:   换一换
      忘记密码?
        
    友情提示
    2、PDF文件下载后,可能会被浏览器默认打开,此种情况可以点击浏览器菜单,保存网页到桌面,就可以正常下载了。
    3、本站不支持迅雷下载,请使用电脑自带的IE浏览器,或者360浏览器、谷歌浏览器下载即可。
    4、本站资源下载后的文档和图纸-无水印,预览文档经过压缩,下载后原文更清晰。
    5、试题试卷类文档,如果标题没有明确说明有答案则都视为没有答案,请知晓。

    科学计算科学计算 (29).pdf

    Chapter 5 Data Analysis and Polynomial Chapter 5 Data Analysis and Polynomial EvaluationEvaluation5.1 Statistical Analysis of Data5.2 Polynomial Evaluation5.3 Data Interpolation5.4 Examples of Data Interpolation Application5.5 Curve Fitting5.6 Examples of Curve Fitting Application5.1 5.1 Statistical Analysis of DataStatistical Analysis of DataFind maximum and minimum elementsCalculate mean and median valuesCalculate sum and productCalculate cumulative sum and cumulative productCalculate standard deviation and correlation coefficientSort1.1.Find maximum and minimum elementsFind maximum and minimum elementsmax():Find the maximum element of a vector or matrix.min():Find the minimum element of a vector or matrix.When the argument is a vector,the function has two syntax:(1)y=max(X):Returns the maximum value of the vector X to y.If X contains plural elements,take the maximum value by module.(2)y,k=max(X):Returns the maximum value of the vector X to y,the sequence number ofthe maximum element is stored in k.If X contains complex elements,the maximum value istaken by modulus.x=-43,72,9,16,23,47;y=max(x)y=72 y,k=max(x)y=72k=2Example 1:Find the maximum element of vector x,where x=-43,72,9,16,23,47.Question:To find the maximum elements of the matrix by row,can it be done by onlyusing the first syntax?When the argument is a matrix,the function has three syntax:(1)max(A):Returns a row vector.The i-th element of the vector is the maximum valueof the i-th column ofA.(2)Y,U=max(A):Returns two arguments which are used to record the maximumvalues for each column and the row number of the maximum element in each columnin matrix A.(3)max(A,dim):dim takes 1 or 2.When dim takes a value of 1,the function stilltakes the maximum value by column.When dim takes a value of 2,the function takesthe maximum value by row,and the return is a column vector,whose i-th element is themaximum value of the i-th row ofA.A13567825632357825563101=Example 2:Find the maximum element of each row and column of matrix A and the maximum element of the entire matrix.Question:How can we get the maximum element of the entire matrix bycalling the max function only once?A=13,-56,78;25,63,-235;78,25,563;1,0,-1;max(A)ans=78 63 563 max(A,2)ans=78635631 max(max(A)ans=5632.Calculate 2.Calculate mean and median valuesmean and median valuesMean value:The mean value of the data series refers to the arithmetic average,which is the sum of each item divided by the number of items.Median value:The median value is the value of the element which happens tobe in the middle in a sorted series.If the number of data is odd,take the value ofthe element whose position is in the middle.If the number of data is even,take thevalue of the average of the two middle elements.In MATLAB,the functions for the mean and median values are:mean():Calculate the mean value.median():Calculate the median value.Question:With the mean,why do we need the median?x=1200,800,1500,1000,5000;mean(x)ans=1900 median(x)ans=1200Example 3:There are five students in a dormitory.Their monthly cost of living is asshown in vector x.One of them,Xiao Ming,is from an ordinary family.What criterionis reasonable for him to ask his parents for the cost of living?x=1200,800,1500,1000,50003.Calculate3.Calculate sum and productsum and productsum():Sum function.prod():Product function.4.Calculate cumulative sum and cumulative product4.Calculate cumulative sum and cumulative productSuppose U is a vector.V and W are two vectors of the same length as U.Such two vectors are respectively called the cumulative sum vector and thecumulative product vector of vector U.In MATLAB,the cumulative sum and cumulative product functions are:cumsum():Cumulative sum function.cumprod():Cumulative product function.X=1,2,3,4,5,6,7,8,9,10;y1=prod(X)y1=3628800 y2=cumprod(X)y2=1 2 6 24 120 720 5040 40320 362880 3628800 Example 4:Find the product and cumulative product of vector X.X is ten integers from 1 to 10.5.Calculate standard deviation and correlation coefficient5.Calculate standard deviation and correlation coefficientStandard deviation is used to calculate the mean distance at which the data deviates from themean.It has two formulas:In MATLAB,the function used to calculate the standard deviation of the data series is std,which has three syntax:(1)std(X):Calculate the standard deviation of vector X.(2)std(A):Calculate the standard deviation of each column of matrix A.(3)std(A,flag,dim):Take 0 or 1 for flag.When flag=0,calculate the sample standarddeviation according to the formula S1;When flag=1,calculate the overall standard deviationaccording to the formula S2.By default,flag=0 and dim=1.11()121SNxxiiN=1()221SNxxiiN=x=randn(50000,4);y1=std(x,0,1)y1=0.9902 0.9881 0.9827 1.0007 y2=std(x,1,1)y2=0.9901 0.9880 0.9826 1.0006 x1=x;y3=std(x1,0,2);y3ans=0.9902 0.9881 0.9827 1.0007 y4=std(x1,1,2);y4ans=0.9901 0.9880 0.9826 1.0006 Example 5:Create a 50,000 by 4 random matrix which satisfies normal distribution,andcalculate the standard deviations of each column in different ways.Correlation coefficient is an indicator of the interrelationship between two series of data,itsformula is:In MATLAB,the function used to calculate the correlation coefficient is corroef,which has twosyntax:(1)corrcoef(A):Return a matrix of correlation coefficients formed by matrix A.And in it,theelement of the i-th row and i-th column indicates the correlation coefficient of the i-th and j-thcolumn of the original matrix A.(2)corrcoef(X,Y):Here,X and Y are vectors,which are used to find the correlation coefficientbetween X and Y vectors just like corrcoef(x,y).iiiirxxyyxxyy()()()()22=-1,+1Sales volume in one monthScheme IScheme 2Scheme 3Warehouse 15032600051005200Warehouse 26532650066005800Warehouse 35500700054004800Warehouse 44530400043004200Warehouse 52300200022002500Warehouse 63254300035003000Warehouse 78095900078008500Warehouse 87530800070007500Warehouse 93841320035003200Warehouse 104500520048004000Example 6:A new product is to be listed.Before that,the logistics department of thecompany distributed the new products to 10warehouses in different regions for sale.Onemonth after product was listed,the companyhas to evaluate different distribution schemesso that the company can distribute moreaccurately the next time a new product islisted,and thus avoid backlogs and stockoutsowing to misdistribution.The right tableshows the relevant data.Please judge whichdistribution scheme makes the most sense.A=5032,6000,5100,5200;6532,6500,6600,5800;5500,7000,5400,4800;4530,4000,4300,4200;2300,2000,2200,2500;3254,3000,3500,3000;8095,9000,7800,8500;7530,8000,7000,7500;3841,3200,3500,3200;4500,5200,4800,4000;corrcoef(A)ans=1.0000 0.9630 0.9906 0.97820.9630 1.0000 0.9694 0.94660.9906 0.9694 1.0000 0.96350.9782 0.9466 0.9635 1.00006 6.S SortortIn MATLAB,the sort function is sort(),and its calling format is:(1)sort(X):Sorting vector X in ascending order.(2)Y,I=sort(A,dim,mode):Where dim indicates whether to sort As columns or rows.Mode indicates whether to sort in ascending or descending order.If“ascend”is selected,itwill be sorted in ascending order.If“descend”is selected,it will be sorted in descendingorder.The default is ascending order.In the output parameter,Y is the sorted matrix,while Irecords the position of the elements of Y inA.A=1,-8,5;4,12,6;13,7,-13;sort(A)ans=1 -8 -134 7 513 12 6 sort(A,2,descend)ans=5 1 -812 6 413 7 -13A185412613713=X,I=sort(A)X=1 -8 -134 7 513 12 6I=1 1 32 3 13 2 2Example 7:Sort the following matrix.

    注意事项

    本文(科学计算科学计算 (29).pdf)为本站会员(奉***)主动上传,淘文阁 - 分享文档赚钱的网站仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。 若此文所含内容侵犯了您的版权或隐私,请立即通知淘文阁 - 分享文档赚钱的网站(点击联系客服),我们立即给予删除!

    温馨提示:如果因为网速或其他原因下载失败请重新下载,重复下载不扣分。




    关于淘文阁 - 版权申诉 - 用户使用规则 - 积分规则 - 联系我们

    本站为文档C TO C交易模式,本站只提供存储空间、用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。本站仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知淘文阁网,我们立即给予删除!客服QQ:136780468 微信:18945177775 电话:18904686070

    工信部备案号:黑ICP备15003705号 © 2020-2023 www.taowenge.com 淘文阁 

    收起
    展开