0

嗨,我有一个函数 ((4*pi*100./lambda).^2),我需要绘制由 randn() 完成的每个值偏差,但它只绘制函数 ((4*pi*100./ λ).^2).

c=3e8;

f=0.1e12:0.1e12:10e12;

lambda=c./f;

spread=((4*pi*100./lambda).^2);

y = spread + randn(size(f));

plot(y,(1:100))
4

2 回答 2

0

您可以使用错误栏

    c=3e8;

    f=0.1e12:0.1e12:10e12;

    lamda=c./f;

    spread=((4*pi*100./lamda).^2);

    y = spread ;
    err_vals = randn(size(f))

    %plot(y,(1:100))
    errorbar(y,err_vals)
于 2014-06-09T23:14:35.687 回答
0

I did make it work. Yes size of random numbers was to small and two matrices had different sizes. Command used to find out matrices size is whos.

 c=3e8;

f=0.1e12:0.1e12:10e12;
 lamda=c./f;

 spread= ((4*pi*100./lamda).^2)

  abs = randi([20 35543e9],1,100)
 whos spread abs
     A = spread + abs
     y= 10*log(A)

     plot(f,y)
于 2014-06-10T18:07:31.553 回答