Similate single sine wave

1 回表示 (過去 30 日間)
MadjeKoe
MadjeKoe 2020 年 11 月 15 日
回答済み: MadjeKoe 2020 年 11 月 17 日
Hi all! Can somebody tell me if it is possible to similate this wave in matlab? Including the raw data on the background and the same axes? Thank u in advance!

回答 (2 件)

Setsuna Yuuki.
Setsuna Yuuki. 2020 年 11 月 15 日
I commented in other post, but this is a possible answer:
time = linspace(-40,40,2000); %change limits
signal = 80*sind(2*180*time); %sine wave in degree
i = -40; j = 1;
comp = 25:25:2000;
vectorx = zeros(1,length(time));
% Simulated Error
for n = 1:length(time)
vectorx(n) = i;
if(n == comp(j))
i = i+1;
j = j+1;
end
end
errorSimulated = rand(1,length(vectorx));
%End simulated error
yyaxis left; %name axis Y left
plot(time,signal); hold on; %plot sine wave0
ylabel('Sinusoidal signal')
ylim([-90 90]) %Y limits
yyaxis right; %name axis Y right
scatter(vectorx,errorSimulated,'filled','r') %scatter of error
ylabel('Simulated error')
xlim([-40 40]) %X limits

MadjeKoe
MadjeKoe 2020 年 11 月 17 日
Thank u very much, but I think I did something wrong, as this is the image that I get.

カテゴリ

Help Center および File ExchangeMatrix Indexing についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by