Filter löschen
Filter löschen

plot two variables of different length

4 Ansichten (letzte 30 Tage)
priya
priya am 4 Jul. 2021
Beantwortet: Image Analyst am 4 Jul. 2021
x = 100:400 ;
y = 600:1500 ;
Z = 3*x+2*y ;
P = x/Z;
I want to plot P (along z axis) as a function of x (along x axis) and y (along y axis).

Akzeptierte Antwort

Image Analyst
Image Analyst am 4 Jul. 2021
x = 100:400 ;
y = 600:1500 ;
[X, Y] = meshgrid(x, y);
Z = 3 * X + 2 * Y;
subplot(1, 2, 1);
surf(X, Y, Z, 'EdgeColor', 'none');
fontSize = 15;
xlabel('X', 'FontSize', fontSize);
ylabel('Y', 'FontSize', fontSize);
zlabel('Z', 'FontSize', fontSize);
title('Z = 3 * X + 2 * Y', 'FontSize', fontSize);
colormap(jet(256));
colorbar;
P = X ./ Z;
subplot(1, 2, 2);
imshow(P, [], 'XData', x, 'YData', y);
xlabel('X', 'FontSize', fontSize);
ylabel('Y', 'FontSize', fontSize);
zlabel('Z', 'FontSize', fontSize);
axis('on', 'xy');
title('P = X ./ Z', 'FontSize', fontSize);
colorbar;
impixelinfo;
g = gcf;
g.WindowState = 'maximized'

Weitere Antworten (0)

Tags

Produkte


Version

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by