Matlab仿真及其应用66

时间:2024.4.13

温州大学物理与电子信息工程学院

 Matlab仿真及其应用 实验报告

 


实验名称:实验三 Matlab基本编程操作

实验目的:

1、 熟悉Matlab的脚本编写

2、 熟悉Matlab的函数编写

3、 书写Matlab的变量使用

4、 熟悉Matlab的程序控制结构

实验内容:

1. 分别选用if或switch结构实现函数表示

2. 根据近似计算指数,当与指数函数的误差小于0.01时停止,分别用for和while 结构实现。

3. 迭代计算,给出可能的收敛值,并给出不同收敛对应的处置范围。

4. 在第3题的代码中增加try和catch控制块,以避免出现的情况

5. 从键盘输入数值,迭代计算


实验结果及分析:

1、分别选用if或switch结构实现函数表示

新建M-file

编写程序

function y=function1(x,a)

        if x<=-a

            y=-1;

        elseif -a<x&&x<a

                y=x/a;

            else

                y=1;

            end

保存后在命令窗口键入y=function1(1,5)

运行结果:

Switch实现:

function y=function1(x,a)

 switch x

   case x<=-a

            y=-1;

   case    -a<x&&x<a

                y=x/a;

     otherwise  

               y=1;

            end

保存后在命令窗口键入y=function1(1,5)

运行结果:

>> y=function1(1,5)

y =

    0.2000

2、根据近似计算指数,当与指数函数的误差小于0.01时停止,分别用for和while 结构实现。

用for 结构实现:

用for结构:

function y=function3(x)

y=1;t=1;a=x;m=y+x;

for i=1:inf

if (m-y)>=0.00001

    y=y+a/function1(t);

    a=a*x;

    t=t+1;

    m=y+a/function1(t);

else

    break;

end

end

end

function y=function1(n)

    y=1;

    for i=1:1:n

        y=y*i;

    end

end

运行结果:

用while 结构实现:

function y=function1(x)

          y=1;i=1;a=1;

        while abs(a*(x/(i+1)-1))>0.00001|i<10

             a=1;

        for i=1:1:i

            a=a*x;

            a=a/i;

        end

            y=y+a;

              i=i+1;

        end

运行结果:

3、迭代计算,给出可能的收敛值,并给出不同收敛对应的处置范围。

function y=function3(x)

 x0=x/2;

 x1=3/(x0+2);

 while abs(x0-x1)>=0.00001

x0=x1;

    x1=3/(x0+2);

    x1

end

4、在第3题的代码中增加try和catch控制块,以避免出现的情况

function y=function4(x)

 x0=x/2;

 x1=3/(x0+2);

 while abs(x0-x1)>=0.00001

x0=x1;

    x1=3/(x0+2);

    try

        x0=-2;

    catch

        disp('error');

    end

end

5、 从键盘输入数值,迭代计算

function function5()

x=input('input a number:');

 x0=x/2;

 x1=3/(x0+2);

 while abs(x0-x1)>=0.00001

x0=x1;

    x1=3/(x0+2);

    x1

end

运行结果

>> function5()

input a number:5

x1 =

    1.1250

x1 =

    0.9600

x1 =

    1.0135

x1 =

    0.9955

x1 =

    1.0015

x1 =

    0.9995

x1 =

    1.0002

x1 =

    0.9999

x1 =

    1.0000

x1 =

    1.0000

x1 =

    1.0000

评定成绩:


第二篇:My thoughts about the Lady of the Camellias茶花女英文读后感


The Lady of the Camellias by Alexandre Dumas fils

Class_3

No.

Name

My thoughts about the Lady of the Camellias

 

The Lady of the Camellias also called La dame aux camélias in French is a novel written by Alexandre Dumas fils. This novel tells about a love story between a prostitute, Marguerite Gautier and a young provincial bourgeois, Armand Duval. Though Marguerite Gautier was a prostitute, she had a pure heart. She fell in love with Armand Duval, and then tried to escape from her questionable past. They loved each other very much, and they even imagined a picture of their bright future and happy life. However, things always do not go as expected. Unfortunately, the former life came back to haunt her and she returned to that life again and died painfully and alone. And because of many other factors , their love ended up with a tragedy.

The female protagonist in this novel was a poor village girl. She was very beautiful and kind-hearted. In order to earn her living, she became a prostitute, but she still was a noble woman at heart. She longed for true love, and then she lost her heart to Armand Duval. She was not like other prostitutes, and she had her own thoughts. Outwardly, she lived a voluptuous life, bur she was depressed in her heart. She was eager to go back to a ordinary life. Just because that, when Armand Duval ran after her , she fell for him quickly.

Maybe because she lived in such a insincere society for a long time that she took her love more important than any other things. She would gave her whole world for her love. She did not want the money to be involved in their love. She didn't want to spend Armand Duval's money, because she thought the money would contaminate their pure love and she did not want Armand Duval to make a mistake that she was a material woman. She just wanted a pure love without any other things. Therefore, she tried her best to support their love. After their source of income from the old duke was cut, Marguerite Gautier started to sell all her things to pay her debts and support their life without telling Armand Duval. This action expressed how important Marguerite Gautier took their love and how much she loved the man.

But on the other hand, Marguerite Gautier was a little stupid. She believed that as a prostitute, it was a big favor to accept a pure love from the fate. So she should do more to repay it. How silly she was! She was wrong. She did not know the true love was not only to share happiness but also to share sorrows. She should tell her thoughts to Armand Duval and solve the problem with him instead of by herself. And if so, there was no gap and suspicion between them.

    Another characteristic of Marguerite Gautier was she was too kind-hearted that she lacked rebellious spirit. She always had consideration for others, but forgot herself. When Armand Duval's father persuaded her to give up their love and told her that if they lived together , it will ruined the future of Armand Duval and the marriage of the Armand Duval's sister, she really did so regardless of her own feelings. Because she knew she was just a prostitute, she had no right to destroy others' futures and she did not want to do that. She loved Armand Duval very much and she wished him a better life even if she could not live with him. Therefore, she decided to give up their love and bore all the consequences and pains by herself. She was such a selfless lady!

To some degree, the tragedy of Marguerite Gautier was made by herself. She was so kind-hearted, selfless, and considerate. She did not to resist. But there were some other reasons. Armand Duval was skeptical and recreant. He always suspected Marguerite Gautier's love for him and even hurt her when he misunderstood her. And if Armand Duval could be determined, when facing his father, they might not separate at last. All these things were responsible for their love tragedy.

    Personally, I think the biggest obstacle was society. Because it was Capitalist system in that time. Everybody was money-mad and they just valued the money and the social position. The did not allow a prostitute to marry a person who had a good social position. Or they will look down on the person and despised him. Let us imagine that if Armand Duval's father was in favor of them and made them get married, they still would not be accept by society and the public. How could they live? Would they have a happy life? Of course not! So the society should took the most responsibility for their tragedy. And their tragedy was not theirs but also reflected the tragedy of society.

更多相关推荐:
matlab实验心得总结

通过《matlab仿真》实验使我学习掌握了许多知识。首先是对matlab有了一个全新的认识,其次是对matlab的更多操作和命令的使用有了更高的掌握,最重要的事对matlab的处理能力有了一个更高的飞跃尤其是对…

matlab心得体会

MATLAB学习心得体会Matlab,提起它,不管我们上课是否认真听讲了,我们都应该对它不再陌生,我们不可否认它的强大之处,正如一节课时老师给我们说的“Matlab可以做很多事情”。通过近一段的学习,使我更加确…

matlab心得体会

Matlab心得体会班级:电气08-3班姓名:张强学号:24Matlab一个高级的距阵/阵列语言,它包含控制语句、函数、数据结构、输入和输出和面向对象编程特点。用户可以在命令窗口中将输入语句与执行命令同步,也可…

学习matlab心得体会

1前言2matlab的一些特点3学习matlab心得体会4matlab的一些资源1前言我接触Matlab的时间比较长了最开始是在大学里面的数学实验课上了解了一些学了些基础的命令后来参加过一次数学建模又自学了点而...

matlab学习心得

编程心得1helpwin只是寻找函数类一般不如用doc相当于帮助文档中的搜索但在用doc搜索不到帮助文件时可用helpwin如找有关的帮助等打开格式非标准的mat或xls等数据文件如dat文件或无后缀名的文件时...

matlab学习心得体会

Matlab学习心得班级机械124姓名万明男学号20xx093386电话139xxxxxxxxmatlab学习心得体会MATLAB中有丰富的图形处理能力提供了绘制各种图形图像数据的函数他提供了一组绘制二维和三维...

matlab的学习心得

MATLAB的学习体会姓名陈燕民班级11信息2班学号20xx24093246经过一学期的c的学习我们开始转化学习Matlab软件的学习学习Matlab软件应用是一次更高要求的学习计划也是一种结合我们信息专业背景...

matlab使用体会

本人接触matlab已经有5年多的时间了一直想写点东西但是之前不知道放在哪里才能发挥它的最大作用直到几天前碰上了这个论坛有点像诸葛亮遇见姜维哈哈废话不说我想借贵论坛宝地写一些经验给使用matlab的新手们当然了...

ASK信号的仿真分析matlab课程设计报告

武汉理工大学Matlab课程设计报告课程设计任务书学生姓名瞿子敬专业班级通信1104班指导教师张小梅工作单位信息工程学院题目ASK信号的仿真分析课程设计目的1较全面的了解常用的数据分析与处理原理及方法2能够运用...

随机信号matlab仿真

电子科技大学通信与信息工程学院标准实验报告实验名称随机数的产生及统计特性分析电子科技大学实验报告学生姓名吴振国学号20xx019xx0006指导教师周宁实验室名称通信系统实验室实验项目名称随机数的产生及统计特性...

matlab在自动控制方面的仿真

MATLAB在控制系统仿真方面的应用物电0911自动化20xx118121高傲雷摘要MATLAB自问世以来以其优良而强大的数学运算和系统仿真功能深受使用者青睐在数学运算复杂概念抽象的自动控制原理课程中发挥着无与...

matlab学习心得体会

matlab学习心得体会matlab学习心得体会一matlab学习心得MATLAB中有丰富的图形处理能力提供了绘制各种图形图像数据的函数他提供了一组绘制二维和三维曲线的函数他们还可以对图形进行旋转缩放等操作MA...

matlab仿真心得体会(13篇)