Finding the maximum position (x,y) coordinate from contour plot
25 views (last 30 days)
Show older comments
%% 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 Comments
DGM
on 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);
Answers (0)
See Also
Categories
Find more on Loops and Conditional Statements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!