Help in 2D plot of coefficients

3 vues (au cours des 30 derniers jours)
Haya Ali
Haya Ali le 11 Jan 2023
Commenté : Haya Ali le 11 Jan 2023
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()

Réponse acceptée

Jonas
Jonas le 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.')
  1 commentaire
Haya Ali
Haya Ali le 11 Jan 2023
You made it simple. Thanks a lot

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur 2-D and 3-D Plots dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by