How can I solve this question?

1 次查看(过去 30 天)
Alice Zurock
Alice Zurock 2020-5-31
------------------------------------------------------------------------------------------------------------------------------------
Example 12.1 Nonlinear Model:
------------------------------------------------------------------------------------------------------------------------------------
Eq. 12.19& Eq. 12.20:
------------------------------------------------------------------------------------------------------------------------------------
Eq. 12.22& Eq. 12.23:
  2 个评论
KSSV
KSSV 2020-5-31
What have you attempted?
Alice Zurock
Alice Zurock 2020-5-31
clc; clear; close all; format compact; format long eng;
rng('default');
% true signal curve
x = (0:.1e-4:2).';
y = .2 * ones(length(x),1) - x + .9 * x.^2 + .7 * x.^3 - .2 * x.^5;
% plot the true curve
%figure; plot(x1,y1,'b');
% training samples (20 or 500)
N = 20;
% sample interval [a b]
a = 0; b = 2;
% generate samples
x1 = (a : b/N : b - b/N).';
% noise generation
sigma_n = .05;
n = sqrt(sigma_n) .* randn(N,1);
% use the true theta
theta_true = [.2; -1; .9; .7; -.2];
% or a random one
theta_dstrbd = [-0.004; -10.54; 0.465; 0.087; -.093];
l = length(theta_true);
% compute the measurement matrix
Phi = [ones(N,1) x1 x1.^2 x1.^3 x1.^5];

请先登录,再进行评论。

回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Curve Fitting Toolbox 的更多信息

产品


版本

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by