Plot multiple b-value on an error vs frequency plot.

5 次查看(过去 30 天)
I need to plot (a vs Ex_nz) and (a vs Ex_ny) for different values of b= 0.1, b=0.2, b=0.3, b-0.4 and b=0.5. How can I plot these on the same figure just like the R in the image attached?
clear all; close all; clc;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Simulation %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
x(1)=0;
y(1)=0;
a=1:1:14;
b=0.3;
for i=2:10000
x(i)=1-1.4*(x(i-1)^2)+y(i-1);
y(i)=b*x(i-1);
end
%plot(x,y,'.','MarkerSize',2)
%hold on
%xlabel('x')
%ylabel('y')
%title('henon map')
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Observation %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ksaix = [10 -7.6428 2.2896 0 -10.8200 0 -0 0 0 -0 0 -0 0 0 -0 -0];
ksaiy=[0.0000 2.2928 -2.2896 -0 0 -0 0 0 0 0 -0 -0 -0 0 -0 -0];
ksaix_ref=[1 0 1 0 -1.4 0 0 0 0 0 0 0 0 0 0 0];
ksaiy_ref=[0 0.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0];
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
count=0;
for N_m=3:16
count=count+1;
N_measurements=N_m;
N_basis=16;
SDx_sum=(ksaix(1)-ksaix_ref(1))^2+(ksaix(3)-ksaix_ref(3))^2+(ksaix(5)-ksaix_ref(5))^2;
SDy_sum=(ksaiy(2)-ksaiy_ref(2))^2;
SCx_sum=(ksaix_ref(1))^2+(ksaix_ref(3))^2+(ksaix_ref(5))^2;
SCy_sum=(ksaiy_ref(2))^2;
Ex_nz(count)=sqrt(SDx_sum)/sqrt(SCx_sum);
Ey_nz(count)=sqrt(SDy_sum)/sqrt(SCy_sum);
Data(count)=N_measurements/N_basis;
end
figure
hold on
plot (a,Ex_nz,'o-r')
plot (a,Ey_nz,'s-k')
  1 个评论
VBBV
VBBV 2021-1-5
%rue
clear all; close all; clc;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Simulation %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
x(1)=0;
y(1)=0;
a=1:1:14;
b=0.1:0.01:0.3;
for bb = 1:length(b)
for i=2:10000
x(i,bb)=1-1.4*(x(i-1)^2)+y(i-1);
y(i,bb)=b(bb)*x(i-1);
end
end
plot(x,y,'.','MarkerSize',2)
%hold on
%xlabel('x')
%ylabel('y')
Use KSSV method in for loop as above

请先登录,再进行评论。

回答(1 个)

KSSV
KSSV 2021-1-5
Something like this:
clear all; close all; clc;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Simulation %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
n = 10000 ;
x = zeros(1,n) ;
y = x ;
x(1)=0;
y(1)=0;
a=1:1:14;
b = 0.1:0.1:0.5 ;
Ex_nz = zeros(length(b),14) ;
Ey_nz = zeros(length(b),14) ;
Data = zeros(length(b),14) ;
for bb = 1:length(b)
for i=2:10000
x(i)=1-1.4*(x(i-1)^2)+y(i-1);
y(i)=b(bb)*x(i-1);
end
%plot(x,y,'.','MarkerSize',2)
%hold on
%xlabel('x')
%ylabel('y')
%title('henon map')
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Observation %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ksaix = [10 -7.6428 2.2896 0 -10.8200 0 -0 0 0 -0 0 -0 0 0 -0 -0];
ksaiy=[0.0000 2.2928 -2.2896 -0 0 -0 0 0 0 0 -0 -0 -0 0 -0 -0];
ksaix_ref=[1 0 1 0 -1.4 0 0 0 0 0 0 0 0 0 0 0];
ksaiy_ref=[0 0.3 0 0 0 0 0 0 0 0 0 0 0 0 0 0];
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
count=0;
for N_m=3:16
count=count+1;
N_measurements=N_m;
N_basis=16;
SDx_sum=(ksaix(1)-ksaix_ref(1))^2+(ksaix(3)-ksaix_ref(3))^2+(ksaix(5)-ksaix_ref(5))^2;
SDy_sum=(ksaiy(2)-ksaiy_ref(2))^2;
SCx_sum=(ksaix_ref(1))^2+(ksaix_ref(3))^2+(ksaix_ref(5))^2;
SCy_sum=(ksaiy_ref(2))^2;
Ex_nz(bb,count)=sqrt(SDx_sum)/sqrt(SCx_sum);
Ey_nz(bb,count)=sqrt(SDy_sum)/sqrt(SCy_sum);
Data(bb,count)=N_measurements/N_basis;
end
end
figure
hold on
plot (a,Ex_nz,'o-r')
plot (a,Ey_nz,'s-k')

类别

Help CenterFile Exchange 中查找有关 Creating, Deleting, and Querying Graphics Objects 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by