2d filled contour plot

3 Ansichten (letzte 30 Tage)
Shehab Abougamrah
Shehab Abougamrah am 8 Jan. 2021
Kommentiert: Star Strider am 8 Jan. 2021
I have an x and y data coordinates of an l shaped plate and z data of corresponding displacements and each matrix is 23 rows.
can anyone help me draw a 2d filled contour plot
x = [0;0.03;0.03;0.01;0.01;0;0.02;0.02;0.01;0;0.01;0.02;0.015;0.005;0.025;0.03;0.025;0.01;0.005;0;0.01;0.005;0]
y = [0;0;0.01;0.01;0.04;0.04;0;0.01;0.025;0.025;0;0.005;0.01;0.005;0;0.005;0.01;0.0175;0.025;0.0125;0.0325;0.04;0.0325]
z = [0.002071017;0.002090221;0.001384402;0.001358957;0;0;0.002078694;0.001373731;0.000432053;0.000422168;0.002069412;0.001727074;0.001369789;0.001713017;0.002084764;0.00173648;0.00137873;0.000855225;0.000414625;0.001187851;0.000125043;0;0.000124721]

Akzeptierte Antwort

Star Strider
Star Strider am 8 Jan. 2021
Try this:
x = [0;0.03;0.03;0.01;0.01;0;0.02;0.02;0.01;0;0.01;0.02;0.015;0.005;0.025;0.03;0.025;0.01;0.005;0;0.01;0.005;0];
y = [0;0;0.01;0.01;0.04;0.04;0;0.01;0.025;0.025;0;0.005;0.01;0.005;0;0.005;0.01;0.0175;0.025;0.0125;0.0325;0.04;0.0325];
z = [0.002071017;0.002090221;0.001384402;0.001358957;0;0;0.002078694;0.001373731;0.000432053;0.000422168;0.002069412;0.001727074;0.001369789;0.001713017;0.002084764;0.00173648;0.00137873;0.000855225;0.000414625;0.001187851;0.000125043;0;0.000124721];
N = 15;
xv = linspace(min(x), max(x), N);
yv = linspace(min(y), max(y), N);
[X,Y] = ndgrid(xv, yv);
Z = griddata(x,y,z,X,Y,'linear');
figure
contourf(X, Y, Z, 'ShowText','on')
xlabel('x')
ylabel('y')
Change ’N’ to get different results.
  4 Kommentare
Shehab Abougamrah
Shehab Abougamrah am 8 Jan. 2021
cheers mate this really helped
Star Strider
Star Strider am 8 Jan. 2021
Cheers indeed!
Thank you!

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Kategorien

Mehr zu Contour Plots finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by