1、首先打开matlab软件,然后新建一个m文件,如下图所示。
2、然后在新建的m文件里面输入常量和变量,如下图所示,变量一般用x来表示。
3、接着建立一个for...end循环指令用来产生一段曲线的数据,并且在for循环里面插入两个需要分段的if...end判断指令。
4、接着在输入画二维图形的指令plot函数即可,因为变量x和函数y是具有相同长度的列矩阵。
5、然后把鼠标移动到最上面的run绿色按钮,点击运行,这时候就可以看到,经过运行的所有代码就会形成一个分段函数。
有一个绘图函数你可能不知道但正是你需要的: plotyy()
>> help plotyy
plotyy graphs with y tick labels on the left and right.
plotyy(x1,y1,x2,y2) plots y1 versus x1 with y-axis labeling
on the left and plots y2 versus x2 with y-axis labeling on
the right.
therefore的用法1:therefore的意思是因此,为此,所以;是副词,引导结果、结局或结论,不能误作连词用。
therefore的用法2:therefore可引出一个独立句,但不能连接两个句子,因此当therefore前没有and等连词时,前面须用分号。
therefore的用法3:连接副词therefore用于句首时后面无需逗号,若位于句中前面可加也可不加逗号。
例句如下:
1. The truth is that junk bonds were misnamed, and therefore misunderstood.
事实上人们对垃圾债券的称谓有误,所以产生了误解。
2. They had seen him trawling and therefore knew that there were fish.
他们曾见过他用拖网,因此知道那里有鱼。
3. Men are anxious to improve their circumstances, but are unwilling to improve themselves; they therefore remain bound.
我们总是渴望改善周遭环境,但是却不愿意改善自己,因此总停留在原地,无法进步。
4. He is only 17 and therefore not eligible to vote.
他只有17岁,因此没有投票选举的资格。
5. He lost his health, and therefore his difficulties increased.
他身体虚弱, 因此更增加了他的困难.therefore有两种用法,一在整句中,一在分句中。therefore是副词,但有时具有连词作用。
一、整句中时一般不放句末,句首后要有逗号,句中1、按一般副词使用2、做插入语(这两个分得清吧)
eg.1、Therefore,we must learn English well.
2、They therefore can learn English well.
3、Many fast food restaurant ,therefore,have red furniture or walls.
二、用在分句中,即一个句子一部分表示原因一部分表示结果。
这时一般词前要用分号,其后用不用逗号无所谓。若第二个分句前是逗号或无符号,则要注意therefore是副词,和so不一样,要保持句子完整,应用and therefore。
eg.1、I had a headache;therefore I could not go to your party.
2、I was ill,and therefore could not come.
3、These birds are very beautiful and therefore liked by many people.都表示“因此”,therefore 和 thereby 用法和含义不尽相同。