Plot multiple b-value on an error vs frequency plot.
2 views (last 30 days)
Show older comments
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 Comment
VBBV
on 5 Jan 2021
%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
Answers (1)
KSSV
on 5 Jan 2021
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')
See Also
Categories
Find more on Line Plots 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!