Finding the maximum position (x,y) coordinate from contour plot

조회 수: 25 (최근 30일)
Susmita Panda
Susmita Panda 2021년 8월 24일
댓글: DGM 2021년 8월 31일
%% ABGS
clc
clear all
eta_dom=1:5;
epsilon_dom=6:10;
n_load=1:5;
Disp_dom=[1:5;6:10;11:15;16:20;21:25];
eta_len=length(eta_dom);
eps_len=length(epsilon_dom);
load_len=length(n_load);
Dis_max_1=zeros(load_len,1);
Disp=zeros(eta_len,eps_len);
tic
for ie=1:eta_len
eta=eta_dom(ie);
ie
for s=1:eps_len
eps=epsilon_dom(s);
s
for k=1:load_len
load=n_load(k);
k
Disp=Disp+Disp_dom;
end
end
end
toc
% [x, y] = meshgrid(epsilon_dom,eta_dom);
% % [C, h] = contour(x, y, Disp);
% [max_e,index] = max(abs(Disp));
% [max_e_1,index_1] = max(max_e);
% Dis_max_1(k,1)=max_e_1;
% x_max = x(index_1);
% y_max = y(index_1);
% x_m(k,1)=x_max;
% y_m(k,1)=y_max;
%
% figure();s1=contourf(epsilon_dom,eta_dom,Disp);view(2);colormap(hot);colorbar;set(colorbar,'linewidth',1.5,'Box','on');hold on;
% figure();plot(n_load,Dis_max_1);
% figure();plot(n_load,x_m);
% figure();plot(n_load,y_m);
In the above attached matlab code I am trying to find the position (x,y) coordinates from contour plot. I want to plot contour between 'Disp','eta_dom','epsilon_dom' for 'n_load'. I want to find maximum X (eta_dom) and Y (epsilon_dom) coordinate for different n_load=1,2....for max(summation displacement) (Z).
I am trying to plot n_load (x) vs max disp (y); n_load (x) vs max eta (y) and n_load (x) vs max epsilon (y). But here I am doubtful about results as my 'disp' is summed up, i am getting single maximum value only whereas I want each of the max displ for each of the summing load.
  댓글 수: 3
Ashutosh Singh Baghel
Ashutosh Singh Baghel 2021년 8월 31일
Hi Susmita,
I believe you want to plot the 3-d contour plot using ‘eta_dom’ and ‘epsilon_dom’ as ‘x’ and ‘y’ respectively and Disp as the ‘z’ variable. Please refer to an example code provided below with some modifications.
fig_1 = figure();
[x, y] = meshgrid(epsilon_dom,eta_dom);
% [C, h] = contour3(x, y, Disp);
[max_e,index] = max(abs(Disp'));
[max_e_1,index_1] = max(max_e);
Dis_max_1(k,1)=max_e_1;
x_max = x(index_1);
y_max = y(index_1);
x_m(k,1)=x_max;
y_m(k,1)=y_max;
%s1=contour(epsilon_dom,eta_dom,Disp);
s1=contour3(epsilon_dom,eta_dom,Disp);
% view(2);
colormap(hot);
colorbar;
set(colorbar,'linewidth',1.5,'Box','on');
hold on;
fig_2 = figure();
plot(n_load,max_e,'s--');
fig_3 = figure();
plot(n_load,x_m);
DGM
DGM 2021년 8월 31일
I don't really understand what you're trying to do if finding the maximum value isn't what you want.
The whole set of loops is confusingly unnecessary.
Disp = load_len*eta_len*eps_len*Disp_dom;
eta = eta_dom(end);
eps = epsilon_dom(end);
load = n_load(end);

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

답변 (0개)

카테고리

Help CenterFile Exchange에서 Contour Plots에 대해 자세히 알아보기

제품


릴리스

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by