How can I plot the graph with one boundary condition?
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I developed the following program. For finding the value, the code is working properly. However, I am finding it difficult to plot the graph between kq and b with the boundary condition Y1<Y.
clear all
clc
syms nq
H=4;
gama=18.4;
q=10;
const=pi/180
phi=30*const;
delta=(0)*phi;
psi=0;
f=phi+delta;
g=phi-psi;
h=psi+delta;
a=0.5;
b=1;
q' == q*b/(b+(2*a));
nq = 2*q'*(H-a)/(gama*(H^2))
A=(2*q'*b)/(gama*(H)^2);
alphacm=atan((sin(f)*sin(g)+(((sin(f)^2)*(sin(g)^2))-A*cos(f)*sin(g)*cos(h)+cos(g)*sin(f)*sin(g)*cos(f))^0.5)/((cos(g)*sin(f))-A*cos(h)))
kg=((tan(alphacm-phi)+tan(psi))*cos(alphacm-phi))/(tan(alphacm)*(cos(alphacm-phi-delta)))
r=(b/(H-a))*(tan(alphacm))
kq=r*kg
U=tan(alphacm)
Y = H/U
Y1 = a+b
Y1<Y
0 Commenti
Risposte (1)
Kartik
il 21 Feb 2023
Hi Akshay,
To plot a graph between kq and b while also ensuring the condition Y1 < Y is satisfied, you can use a loop to evaluate the expressions for a range of b values and then plot the corresponding kq values that satisfy the condition. Here is an example code that demonstrates this approach:
(Note that you need to define the variable alphacm and you didn't provide the equation for it in your code snippet, so you may need to add that in if you haven't already. Also note that the range of b values in the example code is just an arbitrary range - you may need to adjust it based on the specific problem you are trying to solve.)
H = 4;
gama = 18.4;
q = 10;
const = pi/180;
phi = 30*const;
delta = 0*phi;
psi = 0;
f = phi+delta;
g = phi-psi;
h = psi+delta;
a = 0.5;
% Create a range of b values
b_values = 0.1:0.1:3;
% Evaluate kq for each b value and plot the ones that satisfy Y1 < Y
kq_values = zeros(size(b_values));
for i = 1:length(b_values)
% Compute q'
qb = q*b_values(i)/(b_values(i)+(2*a));
% Compute nq
nq = 2*qb*(H-a)/(gama*(H^2));
% Compute kq
r = (b_values(i)/(H-a))*tan(alphacm);
kg = ((tan(alphacm-phi)+tan(psi))*cos(alphacm-phi))/(tan(alphacm)*(cos(alphacm-phi-delta)));
kq = r*kg;
% Check if Y1 < Y
Y = H/tan(alphacm);
Y1 = a+b_values(i);
if Y1 < Y
kq_values(i) = kq;
end
end
% Plot kq vs. b for the values that satisfy Y1 < Y
plot(b_values(kq_values~=0), kq_values(kq_values~=0))
xlabel('b')
ylabel('kq')
0 Commenti
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!