Help with an exercise
Show older comments
Write a function that given a vector x generates a vector y=sin(x) in which it has added a certain noise (simulating to be typical of the environment). This noise must be of mean 0 and ¼ standard deviation, use the randn() function (doc randn for more information). Graph the original function and the function with added noise, contrast both graphs with different colors. Vary the mean and/or standard deviation on the added noise and analyze the behavior on the graph.
Based on this, I have to do another function that receives this vector, filters it and graphs it by using a formule. My problem is that I don't get how to do this with the code
2 Comments
Steven Lord
on 13 Apr 2022
This sounds like a homework assignment. If it is, show us the code you've written to try to solve the problem and ask a specific question about where you're having difficulty and we may be able to provide some guidance.
If you aren't sure where to start because you're not familiar with how to write MATLAB code, I suggest you start with the free MATLAB Onramp tutorial (https://www.mathworks.com/support/learn-with-matlab-tutorials.html) to quickly learn the essentials of MATLAB.
If you aren't sure where to start because you're not familiar with the mathematics you'll need to solve the problem, I recommend asking your professor and/or teaching assistant for help.
Levi Ackerman
on 13 Apr 2022
Accepted Answer
More Answers (1)
David Hill
on 13 Apr 2022
x=0:.01:2*pi;
sigma=0.25;
s=sigma*randn(1,length(x));
y=sin(x);
plot(x,y,x,y+s);
Categories
Find more on Directed Graphs in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!