Help in 2D plot of coefficients

2 views (last 30 days)
Haya Ali on 11 Jan 2023
Commented: Haya Ali on 11 Jan 2023
I have to plot a figure like this.
Real Coefficient= [0.0723, -11.0000, 0.001, 0.0011, 0.0012, 0.0013, 0.0014, 0.0015, 0.0016, 0.0017, 0.0018, 0.0019, 0.00110, 0.00111, 0.00112, 0.00113, 0.00114, 0.00115, 0.00116, 0.00117, 0.00118, 0.00119, 0.00120, 0.00121, -1, -1] ;
Predicted Coefficient= [-0.9265, -11.0000, 0.001, 0.0011, 0.0012, 0.0013, 0.0014, 0.0015, 0.0016, 0.0017, 0.0018, 0.0011, 0.0011, 0.0011, 0.0011, 0.0011, 0.0011, 0.0012, 0.0012, 0.0012, 0.0012, 0.0012, 0.0012, 0.0012, -1, -1] ;
close all; clear all; clc;
data= [0.0723, -0.9265;
-11.0000, -11.0000;
0.001, 0.001
0.0011, 0.0011
0.0012, 0.0012
0.0013, 0.0013
0.0014, 0.0014
0.0015, 0.0015
0.0016, 0.0016
0.0017, 0.0017
0.0018, 0.0018
0.0019, 0.0011
0.00110,0.0011
0.00111,0.0011
0.00112,0.0011
0.00113,0.0011
0.00114,0.0011
0.00115,0.0012
0.00116,0.0012
0.00117,0.0012
0.00118,0.0012
0.00119,0.0012
0.00120,0.0012
0.00121,0.0012
-1.0000,-1.0000
-1.0000,-1.0000];
dy=0.2;
f=figure;
t=tiledlayout("flow");
nexttile(t);
h=scatter(x,y,100,'filled','MarkerEdgeColor','k');
C = jet(numel(x));
h.CData = C;
set(gca, 'colormap', C)
colorbar()

Jonas on 11 Jan 2023
why not use normal plot command?
RealCoefficient= [0.0723, -11.0000, 0.001, 0.0011, 0.0012, 0.0013, 0.0014, 0.0015, 0.0016, 0.0017, 0.0018, 0.0019, 0.00110, 0.00111, 0.00112, 0.00113, 0.00114, 0.00115, 0.00116, 0.00117, 0.00118, 0.00119, 0.00120, 0.00121, -1, -1] ;
PredictedCoefficient= [-0.9265, -11.0000, 0.001, 0.0011, 0.0012, 0.0013, 0.0014, 0.0015, 0.0016, 0.0017, 0.0018, 0.0011, 0.0011, 0.0011, 0.0011, 0.0011, 0.0011, 0.0012, 0.0012, 0.0012, 0.0012, 0.0012, 0.0012, 0.0012, -1, -1] ;
plot(PredictedCoefficient,'or')
hold on;
plot(RealCoefficient,'+k');
xlabel('Term ID');
ylabel('V');
legend('Predicted Coeff.','Real Coeff.')
Haya Ali on 11 Jan 2023
You made it simple. Thanks a lot