Borrar filtros
Borrar filtros

How to substitute value in equation already have

2 visualizaciones (últimos 30 días)
Ahmad khan
Ahmad khan el 10 de Abr. de 2021
Respondida: Vaibhav el 14 de Feb. de 2024
P=k*l*cos(a)*(1-(sin(b)/sin(a))) -----------1
sin(a)=sin(b)^3 ---------2
What i have done is differentiated the eq-1 with respect to a and got the eq-2 in form of long variable like ~in(a/pi, 'integer') & (sin(b) == sin(a)^3 | k == 0 | l == 0)
I have used the diff function and then simplify that equation in MATLAB itself and getting this ~in(a/pi, 'integer') & (sin(b) == sin(a)^3 | k == 0 | l == 0
my QUESTION is that
  1. how I could able to take the only (sin(b) == sin(a)^3 from the simply result
  2. And after taking it from the simplify function substitute in the equation 1 to get something like P= k*l*cos(a)^3 after everything
thank you

Respuestas (1)

Vaibhav el 14 de Feb. de 2024
Hi Ahmad
To extract the specific condition "(sin(b) == sin(a)^3)" from the result of the "simplify" function and then substitute it into equation 1 to simplify the expression for "P", you can follow these steps in MATLAB:
  1. Differentiate equation 1 with respect to a.
  2. Use the "simplify" function to simplify the differentiated expression.
  3. Extract the condition "(sin(b) == sin(a)^3)" from the simplified result.
  4. Substitute this condition into the original equation 1.
  5. Simplify the result to get the expression for "P" in terms of a only.
Here's how you can do this in MATLAB:
syms a b k l P
% Define the original equation
P = k * l * cos(a) * (1 - (sin(b)/sin(a)))
P = 
% Differentiate P with respect to a
dPda = diff(P, a)
dPda = 
% Simplify the differentiated expression
simplified_dPda = simplify(dPda)
simplified_dPda = 
% Assuming you have the condition sin(b) == sin(a)^3 from the simplified result
% Substitute this condition into the original equation for P
P_substituted = subs(P, sin(b), sin(a)^3)
P_substituted = 
% Simplify the substituted expression for P
simplified_P = simplify(P_substituted)
simplified_P = 
After running this code, "simplified_P" should contain the simplified expression for P after substituting the condition "(sin(b) == sin(a)^3)" into the original equation. If the condition is not automatically extracted from the simplification process, you can manually apply the substitution as shown in the code above.
Hope this helps!

Community Treasure Hunt

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

Start Hunting!

Translated by