How do I solve an equation with multiple symbolic variables with a condition on one of the variables?

4 次查看(过去 30 天)
I'm trying to program a concrete column interaction curve and one of the points needed is for a column in pure bending. I'm trying to solve for the values 'c' and 'fs' simultaneously, but I need the absolute values of fs to be limited to less than or equal to the yield stress of steel, Fy. Here is the code below:
Fy = 50;
B1 = 0.85;
rows = 3;
Es = 29000;
d = [2.5 7.5 12.5];
As = [5.08 2.54 5.08];
b =15;
fc = 4;
syms c fs
assume(abs(fs)<=Fy)
for i = 1:rows
fs(i) = (0.003/c)*(c-d(i))*Es
product(i) = As(i)*fs(i)
end
eqn = 0.85*fc*B1*c*b + sum(product) == 0
cM = solve(eqn,c);
cM = double(cM(cM >= 0));
fs = double(subs(fs,c,cM))
When I get my output, the absolute values of fs are still greater than Fy. Can anybody give me some advice? Thanks!

回答(1 个)

Karan Gill
Karan Gill 2017-11-14
编辑:Karan Gill 2017-11-20
You should first solve the equation for c and then use that value to find fs.
Also, your problem sounds like an optimization problem. Consider the Optimization Toolbox: https://www.mathworks.com/help/optim/getting-started-with-optimization-toolbox.html.

Community Treasure Hunt

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

Start Hunting!

Translated by