task:08&09 二维图(5.1-5.9)

语法知识

☺♪ 补充知识点: rand randn randi

在这里插入图片描述

☺♪5.1 线性图函数plot

在这里插入图片描述

☺♪5.2 简易线性图函数

在这里插入图片描述

☺♪5.3 散点图

在这里插入图片描述

☺♪5.4 极坐标及其与直角坐标图的转换

在这里插入图片描述

实例演练

♥♥♥例5-1 随机向量y的线性图

>> y=fix(100*rand(1,8))

y =

    67    75    74    39    65    17    70     3

>> plot(y)
>> grid on
>> title('向量y的线性图')
>> xlabel('candy')
>> ylabel('tooth')

在这里插入图片描述
注:fix()——取整

♥♥♥例5-2 反正切函数及其微分曲线

>> syms x
>> y=atan(x)
 
y =
 
atan(x)
 
>> y1=diff(y)
 
y1 =
 
1/(x^2 + 1)
>>  x=-5:0.1:5;
>> y=eval(y)>> y1 =1./(x.^2 + 1);
>> plot(x,y,'-',x,y1,'*')
>> grid on
>> title('反正切函数及其微分曲线')
>> xlabel(x)
>> xlabel('x')
>> ylabel('y')

在这里插入图片描述

♥♥♥例5-3 复合三角函数图

>> x=-pi:pi/10:pi;
>> y=tan(sin(x));
>> z=sin(tan(x));
>> plot(x,y,'--rs','linewidth',2,'markeredgecolor','k','markerfacecolor','y','markersize',10)
>> hold on
>> plot(x,z,'-bo','linewidth',2,'markeredgecolor','k','markerfacecolor','m','markersize',10)

补充:https://blog.csdn.net/jirryzhang/article/details/77374702 Matlab plot绘图颜色详解
在这里插入图片描述

♥♥♥例5-4 句柄与set命令

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

♥♥♥例5-5 功率曲线

>> t=0:pi/50:4*pi;
>> I=sin(t);
>> V=2*sin(t+pi/3);
>> P=I.*V;
>> plot(t,I,'-',t,V,'--',t,P,'*')
>> grid on

在这里插入图片描述

♥♥♥例5-7 画椭圆

在这里插入图片描述
在这里插入图片描述

♥♥♥例5-8 求函数图像

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
注:两种方法还是有区别的

♥♥♥例5-9 散点图与回归方程

>> A=[1.55,1.58,1.6,1.64,1.66,1.68,1.7,1.73,1.78,1.8,1.82,1.85;60,57,57,65,63,64,70,65,68,76,72,78]

A =

  161.5500    1.5800    1.6000    1.6400    1.6600    1.6800
   60.0000   57.0000   57.0000   65.0000   63.0000   64.0000

  7121.7000    1.7300    1.7800    1.8000    1.8200    1.8500
   70.0000   65.0000   68.0000   76.0000   72.0000   78.0000

>> X=A(1,:)>> Y=A(2,:)>> plot(X,Y,'*b')
>> hold on
>> polyfit(X,Y,1)

ans =

   63.2899  -41.2900

>> x=1.5:0.1:2;
>> y=63.2899*x-41.2900;
>> plot(x,y,'-r');grid on

在这里插入图片描述

♥♥♥例5-10 三叶玫瑰线

>> zeta=0:pi/100:6*pi;
>> r=sin(3*zeta);
>> [x,y]=pol2cart(zeta,r)>> subplot(1,2,1);polar(zeta,r)
>> subplot(1,2,2);plot(x,y);grid on

在这里插入图片描述

♥♥♥例5-11 内摆线(直角坐标→极坐标)

>> x=cos(zeta).^3;
>> y=sin(zeta).^3;
>> zeta=0:pi/20:4*pi;
>> [theta,rho]=cart2pol(x,y);
>> polar(theta,rho)

在这里插入图片描述

总结思考

今天画了好多图呀~(好麻烦QAQ)(不是,开个玩笑)。发现这本书,可以在之后的应用上当做工具书查阅,太多函数以及格式现在来说肯定没有办法…一一记得非常清楚(今天深刻感受到),所以说应该只能在之后的应用中慢慢熟悉…学到现在,发现我们物理实验后面的数据处理,如果一开始自己就写一段代码,不确定度,最小二乘法回归方程。。。什么什么的,就不用像以前花那么长时间,只要输个数据TAT(but,我的物理实验已经结束了23333)emm今天先完成一半任务,明天继续,fighting!

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
                                                                 江宇直表情包三连~↑在这里插入图片描述

Executing tasks: [:app:assembleDebug] in project D:\Users\lenovo\AndroidStudioProjects\Pinduoduo WARNING: The specified Android SDK Build Tools version (27.0.0) is ignored, as it is below the minimum supported version (28.0.3) for Android Gradle Plugin 3.5.2. Android SDK Build Tools 28.0.3 will be used. To suppress this warning, remove "buildToolsVersion '27.0.0'" from your build.gradle file, as each version of the Android Gradle Plugin now has a default version of the build tools. > Task :app:preBuild UP-TO-DATE > Task :app:preDebugBuild UP-TO-DATE > Task :app:checkDebugManifest UP-TO-DATE > Task :app:generateDebugBuildConfig UP-TO-DATE > Task :app:javaPreCompileDebug UP-TO-DATE > Task :app:mainApkListPersistenceDebug UP-TO-DATE > Task :app:generateDebugResValues UP-TO-DATE > Task :app:createDebugCompatibleScreenManifests UP-TO-DATE > Task :app:mergeDebugShaders UP-TO-DATE > Task :app:compileDebugShaders UP-TO-DATE > Task :app:generateDebugAssets UP-TO-DATE > Task :app:compileDebugRenderscript NO-SOURCE > Task :app:compileDebugAidl NO-SOURCE > Task :app:generateDebugResources UP-TO-DATE > Task :app:mergeDebugResources UP-TO-DATE > Task :app:processDebugManifest > Task :app:processDebugResources FAILED AGPBI: {"kind":"error","text":"Android resource linking failed","sources":[{"file":"D:\\Users\\lenovo\\AndroidStudioProjects\\Pinduoduo\\app\\src\\main\\res\\layout\\activity_main.xml","position":{"startLine":34}}],"original":"D:\\Users\\lenovo\\AndroidStudioProjects\\Pinduoduo\\app\\src\\main\\res\\layout\\activity_main.xml:35: AAPT: error: '#875ale' is incompatible with attribute textColor (attr) reference|color.\n ","tool":"AAPT"} FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':app:processDebugResources'. > A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade > Android resource linking failed D:\Users\lenovo\AndroidStudioProjects\Pinduoduo\app\src\main\res\layout\activity_main.xml:35: AAPT: error: '#875ale' is incompatible with attribute textColor (attr) reference|color. * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights. * Get more help at https://help.gradle.org BUILD FAILED in 3s 11 actionable tasks: 2 executed, 9 up-to-date
06-07
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值