创建特定大小的线性排列的数组 [英] Creating a linearly spaced array of a particular size

查看:117
本文介绍了创建特定大小的线性排列的数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是MATLAB的新手,目前正在从事家庭作业.我试图将 x 变量声明为以下内容:

I am new to MATLAB and currently working on my homework assignment. I am trying to declare the x variable as the following:

创建大小为(1×200)的线性间隔数组 x ,其值范围从 -pi pi .

我尝试了以下代码:

x=[-pi:200:pi];

但是我不确定这是否是正确的方法.

but I'm not sure if it's the correct way to do this or not.

推荐答案

您可以按以下方式使用 linspace :

You can use linspace as follow:

x = linspace(-pi, pi, 200);

查看示例: https://www.mathworks.com/help/matlab/ref/linspace.html

这篇关于创建特定大小的线性排列的数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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