大学的Matlab问题 [英] Matlab Problem for University

查看:79
本文介绍了大学的Matlab问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以我对大学进行了这个matlab练习。没什么太难的但我也是新的matlab的东西而且我被卡住了......明天就要到了,所以我真的需要帮助!我会发布问题,如果有人愿意帮助我会很感激:)



创建一个函数,它将收到一个整数N(输入),它会返回两个矢量P1 P2(输出),均为N尺寸。 P1的空间将为[0,5]并且它将包含随机数,而P2的空间将为[5,10]并且也包含随机数。写下每个命令,它将替换P1中的任何数字,大于2.5,用1和P2中的任何数字小于8,用0.

解决方案

请参阅我的评论题。无论如何,我会建议你做什么。



为你做任务毫无意义。首先,对于自己做这项工作的同学来说,这是不公平的。重要的是,它可能会破坏您自己的教育过程,因为您的老师可能会得到有关您实际进度的错误信息,并且无法相应地纠正他们的工作。



所以,这是解决方案。你有两个声音选择:1)更加努力地自己解决问题; 2)来到你的大学顾问,或你的实验室/研讨会的负责人,或你的主题讲师,并告诉这个人你不能应付任务并解释为什么会这样,不要忘记解释 你到底尝试了什么 。这个人将能够纠正她/他的教学,将你的问题考虑在内,并建议你做什么。也许讲座或研讨会的某些部分不够清晰,所以你需要一些额外的解释,更有可能的是,你需要阅读一些关于这个主题的文档,教科书或其他文献。



请注意,正如您所写的那样,问题没有正确制定。 写下每一个命令都不清楚。 P1是一个向量,因此没有定义大于对于向量的含义。它可能是矢量的长度(我希望你知道如何计算它)或其他东西。



-SA

为什么不看看在线提供的各种资源?



例如:

< a href =http://www.tutorialspoint.com/matlab/> MATLAB教程 [ ^ ]

在线Matlab的部分列表教程 [ ^ ]

工程学生MATLAB简介 [ ^ ]



然后使用Google来处理特定问题,比如生成随机数。


Eruanneth问:



好的,所以我对matlab中的整数部分感到困惑。你知道是否有一种方法可以将变量定义为整数?

不,这不是很好的说话。你从一开始就试图做错事。



基本上,答案是: http://www.mathworks.com/help/matlab/numeric-types.html [ ^ ]。



但它不会在这一刻真的帮助你。你是从错误的步骤开始的。在不理解主题的基础知识的情况下进行一些编程是完全没用的:一般原则,技术及其目标,语言等等。您需要从一开始就开始,例如,

http://www.tutorialspoint.com/matlab [ ^ ],

https://en.wikibooks.org/wiki/MATLAB_Programming [ ^ ],

或类似的东西...



-SA


So I have this matlab exercise for university..nothing too difficult but I'm new too the matlab thing and i got stuck..it is due tomorrow so I really need help! I will post the problem if anyone is willing to help I would appreciate it :)

Create a function that it will recieve an integer N (input) and it'll return two vectors P1 P2 (output) both with N size. P1's space will be [0,5] and it'll consists random numbers while P2's space will be[5,10] and consist of random numbers as well. Write every command that it will replace any number in P1 bigger tha 2.5 with 1 and any number in P2 smaller than 8 with 0.

解决方案

Please see my comment to the question. Anyway, I'll advise you what to do.

Doing your assignment for you would be pointless. It would be unfair, first of all, to your fellow students who do this work by themselves. Importantly, it could disrupt your own education process, because your teachers may get wrong information on your actual progress and won't be able to correct their efforts accordingly.

So, here is the solution. You have two sound options: 1) work harder to solve the problem by yourself as well as possible; 2) come to your University adviser, or the head of your labs/seminars, or your lecturer on the topic and tell this person that you cannot cope with the assignment and explain why is that so, don't forget to explain what have you tried so far. This person will be able to correct her/his teaching to take your problems into account and advice your what to do. Perhaps some part of lecture or seminar was not clear enough, so you will need some additional explanation, more likely, you will need to read some documentation, textbook or other literature on the topic.

Note that the problem, as you wrote it, is not correctly formulated. "Write every command" is unclear. P1 is a vector, so it's not defined what "bigger than" may mean for a vector. It could be the length of the vector (I hope you know how to calculate it) or something else.

—SA


Why not take a look at the various resources that are available online?

For example:
MATLAB Tutorial[^]
A Partial List of On-Line Matlab Tutorials[^]
INTRODUCTION TO MATLAB FOR ENGINEERING STUDENTS[^]

And then use Google for specific issues like generating random numbers.


Eruanneth asked:


Ok so I'm confused with the integer part in matlab. Do you know if there is a way of defining a variable to be integer?

No, this is not good talking. You are trying to do wrong things from the very beginning.

Essentially, the answer would be: http://www.mathworks.com/help/matlab/numeric-types.html[^].

But it won't really help you at this moment. You are starting with wrong steps. It's totally useless to do some programming without understanding the basics of the subject: general principles, technology and its goal, the language, and so on. You need to start from the very beginning, for example,
http://www.tutorialspoint.com/matlab[^],
https://en.wikibooks.org/wiki/MATLAB_Programming[^],
or something similar…

—SA


这篇关于大学的Matlab问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆