Help in 2D plot of coefficients

조회 수: 3 (최근 30일)
Haya Ali
Haya Ali 2023년 1월 11일
댓글: Haya Ali 2023년 1월 11일
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.')
  댓글 수: 1
Haya Ali
Haya Ali 2023년 1월 11일
You made it simple. Thanks a lot

댓글을 달려면 로그인하십시오.

추가 답변 (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