So this is the actual problem I am facing. I have been able to partly solve my problem. The issue is that, I am not getting the graph I want.
`% this is to solve the optimization of a two two-bar truss system
close all; clear; clc
%% DEFINED SCALAR PARAMETERS
Aref = 1; %in^2
E = 30 * 10^6;%psi
rho = 0.283;%lb/in^3
P = 10000;%lb
sigma_0= 20000;%psi
h = 100;%in
%% DEFINED PHYSICAL CONSTRAINTS
x1 = linspace(0.1,2.0,1000);
x2 = linspace(0.1,2.5,10000);
[X, Y] = meshgrid(x1, x2);
%% DEFINED OBJECTIVE functions
% Objective function for the weight
obj_fun_1 = 2*( rho * h .* Y .* sqrt((1 + X.^2)) .* Aref) - 0.5;
%Objective function for the displacement of truss beams
obj_fun_2 = P * h *(1+X.^2).^1.5 .*sqrt((1 + X.^4)) ./ ...
(2*sqrt(2)*E .*X.*Y*Aref) - 0.5;
%% PERFORMANCE CONSTRAINTS
% Constraint 1
con_fun_1 = (P * (1 + X).*sqrt((1 + X.^2)))./(2*(sqrt(2))*X.*Y*Aref) <= sigma_0;
% Constraint 2
con_fun_2 = (P * (1 - X).*sqrt((1 + X.^2)))./(2*(sqrt(2))*X.*Y*Aref) <= sigma_0;
%% Question 1a
figure('Name','Objective Function 1')
contour(X,Y, obj_fun_1,1)
hold on
contour(X,Y, con_fun_1,1)
contour(X,Y, con_fun_2,1)
hold off
%% Question 1b
figure('Name','Objective Function 2')
contour(X,Y, obj_fun_2,1)
hold on
contour(X,Y, con_fun_1,1)
contour(X,Y, con_fun_2,1)
hold off
%% Question 1c
obj_fun_combined =obj_fun_2 + obj_fun_2;
figure('Name','Objective Functions Combined')
contour(X,Y, obj_fun_combined,1)
hold on
contour(X,Y, con_fun_1,1)
contour(X,Y, con_fun_2,1)
hold off
`
the obj_fun_1 is supposed to plot the curve in blue, and when you change the constant, i.e -0.5 of the equation, it should make the mulitple plots. But i am getting something way off. And what i understand is that as change the value of the constant the position of the curve of the obj_fun_1 should also be changing but my code is not updating the position of the code even when I change the code. I really need help