小编coo*_*ool的帖子

linspace比冒号":"运算符有什么优势?

写作有一些优势吗?

t = linspace(0,20,21)
Run Code Online (Sandbox Code Playgroud)

过度

t = 0:1:20
Run Code Online (Sandbox Code Playgroud)

我理解前者会产生一个矢量,就像第一个那样.
任何人都可以告诉我一些linspace有用的情况t = 0:1:20吗?

arrays matlab operators

18
推荐指数
3
解决办法
6155
查看次数

在matlab中显示3-D Plot时出错

我想在matlab中绘制以下函数:
f(x,y) = sqrt(1-x^2-4y^2) ,(if (x^2+4*y^2) <=1 )

        =  0                  ,otherwise.
Run Code Online (Sandbox Code Playgroud)

我在matlab中编写了以下代码:

  x=0:0.1:10;  
  y=0:0.1:10;
  z=x.^2+4*y.^2;
  if (z <=1)
   surf(x,y,z);

  else
   surf(x,y,0);
  end
Run Code Online (Sandbox Code Playgroud)

但会显示以下错误:
surface: rows (Z) must be the same as length (Y) and columns (Z) must be the same as length (X)
如何避免此错误...

matlab

2
推荐指数
1
解决办法
785
查看次数

Plotting array of x and y values as points

I can't understand this: when I write the following code I obtain this graph in matlab.

x = [0 1 2 3 4 5];
y = [0 1 0 1 0 1];
figure
plot(x,y);
Run Code Online (Sandbox Code Playgroud)

enter image description here

I had just expected that only the points written in arrays x and y would be plotted ,but the graph shows lines also...
I can't understand why is it so... Please help where am I wrong

matlab matlab-figure

1
推荐指数
1
解决办法
4812
查看次数

在java swings中显示标签和文本字段

我无法理解为什么在以下代码中只显示按钮,为什么不显示标签和文本字段.

import javax.swing.*;
import java.awt.*;

class Invent extends JFrame
{
    public Invent(){
        JFrame c=new JFrame("trying");
        JLabel label1;
        JTextField txtfld1;
        JButton buttoncomp;  

        label1=new JLabel("Enter the path");
        txtfld1=new JTextField();
        buttoncomp=new JButton("Update");
        c.add(label1);
        c.add(txtfld1);
        c.add(buttoncomp);
        c. pack();
        c.setVisible(true);
    }

    public static void main(String[] args)
    {
        new Invent();                                                          
    }
}
Run Code Online (Sandbox Code Playgroud)

请帮忙......

java swing

0
推荐指数
1
解决办法
56
查看次数

标签 统计

matlab ×3

arrays ×1

java ×1

matlab-figure ×1

operators ×1

swing ×1