Random numbers around y-values

조회 수: 1 (최근 30일)
Niklas Kurz
Niklas Kurz 2020년 6월 5일
댓글: Ameer Hamza 2020년 6월 7일
Hello, I've got a set of y-values. I'd like Matlab to plot random numbers around these y-values (max difference:15%). For you info: y values are given in a .txt file (let's say 100x1). Thx in advance

채택된 답변

Ameer Hamza
Ameer Hamza 2020년 6월 6일
Try this
x = 1:100;
y = log(x);
noise = (2*rand(size(y))-1).*0.15.*y;
y_noise = y + noise;
plot(x, y, 'r', x, y_noise, 'b+')
  댓글 수: 4
Niklas Kurz
Niklas Kurz 2020년 6월 7일
Just one thing is striking me: if I type x = 1:10 matlab sets all natural numbers between 1:10. What if I want a slower step rate like 0.1 -wise. ?

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Annotations에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by