资源简介
提供了基于最小二乘法的椭圆拟合matlab仿真程序
代码片段和文件信息
%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% FILENAME ellipseLS.m
% FUNCTIPN Least-squares fit of ellipse to 2D points
% DATE 2015-12-09
% AUTHOR liuzongming
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%
clc;
clear all;
close all;
format long g
%% 生成 带噪声的椭圆
% 参数初始化
g_NumOfPoints = 500; % 点数
g_NormDistrVar = 3; % 标准偏差
a=100;b=200; %长轴短轴
angle= 50; %倾斜角
%% 椭圆生成
beta = angle * (pi / 180);
alpha = linspace(0 360 g_NumOfPoints) .* (pi / 180);
x = (a * cos(alpha) * cos(beta)- b * sin(alpha) * sin(beta) )+wgn(1length(alpha)g_NormDistrVar^2‘linear‘);
y = (a * cos(alpha) * sin(beta)+ b * sin(alpha) * cos(beta) )+wgn(1length(alpha)g_NormDistrVar^2‘linear‘);
plot(x y ‘.‘ ‘Tag‘ ‘DATA‘);
- 上一篇:LM.m
- 下一篇:背景差分 matlab 代码
评论
共有 条评论