嗨,我有一个函数 ((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))
您可以使用错误栏
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)
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)