Help in 2D plot of coefficients

1 次查看(过去 30 天)
I have to plot a figure like this.
Please help. Below is my code.
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
Jonas 2023-1-11
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.')

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 2-D and 3-D Plots 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by