Question
This is a MATLAB question based on Computational Methods and Applications. Please show clear code with clear explanation. Thanks. Will up vote. Down below is
This is a MATLAB question based on Computational Methods and Applications. Please show clear code with clear explanation. Thanks. Will up vote.
Down below is the given HW7p1.m
Same code :
-----------------------------------------------
close all; clear; clc;
set(groot,'defaultAxesTickLabelInterpreter','latex');
set(groot,'defaulttextinterpreter','latex');
set(groot,'defaultLegendInterpreter','latex');
%% generate synthetic data for the noisy signal
t = (1:500)';
x = 2*sin(0.1*t) + 3*cos(0.01*t) + 4*sin(0.02*t);
noise = -ones(size(x)) + 2*rand(size(x));
% generate noisy signal
x_noisy = x + noise;
figure(1)
plot(t,x,'-k','LineWidth',2)
hold on
plot(t,x_noisy,'-b','LineWidth',1)
hold on
set(gca,'FontSize',30)
xlabel('$t$','FontSize',35); ylabel('$x$','FontSize',35,'rotation',0)
axis tight
%% recover an estimate xhat for the original unknown x, only from x_noisy
% your code here (write as many lines as you need here)
beta = [1; 10; 100];
line_style = {'-','-.','--'}; line_color = {'c','m','g'};
% for j=1:length(beta)
%
% % finish the following line
% % xhat(:,j) = ;
%
%
plot(t,xhat(:,j),'color',line_color{j},'linestyle',line_style{j},'LineWidth',2)
% hold on
% end
% legend('$x_{ m{true}}$','$x_{ m{noisy}}$','$\beta = 1$','$\beta = 10$','$\beta = 100$')
% hold off
Estimate the true signal from the measured noisy signal (50 points) 8 6 4 2 TO -2 -4 -6 -8 50 100 150 200 300 350 400 450 500 250 t Download the starter code Hw7p1.m from CANVAS Files section folder HW Problems to your computer, and rename it as Yourlastname YourfirstnameHW7p1.m. The starter code plots a true signal x(t) (in solid black) that is NOT known. Only the noise corrupted signal X noisy(t) (in solid blue), as shown in the plot above, is available. As a data scientist, your job is to recover an estimate a(t) of the true signal from the noisy measured signal X noisy(t). We think of t as time; the noisy signal was measured at 500 different time instances. To solve this problem, you need to formulate it as 499 = arg min || 2 Xnoisy ll2 + B (Xk+1 xk)?, B > 0. k=1 We can interpret the above optimization problem as follows. Since we want the recovered signal to be close to the measured signal
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started