Finding the maximum position (x,y) coordinate from contour plot
26 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
%% 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 Kommentare
Ashutosh Singh Baghel
am 31 Aug. 2021
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
am 31 Aug. 2021
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);
Antworten (0)
Siehe auch
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!