I have a question regarding to the "input()" function. I know that I can input string with the function shown below, for example:
x = input('Please enter your input','s'
But what I want to do is to input a string and then do symbolic derivation based on the string that I input. For instance, the code below:
syms x y a b m n p q H1 H2 H3 H4
y = -(1/(2*x));
b = -(1/(3*a));
n = -(1/(4*m));
q = -(1/(5*p));
R1 = input('Input the string 1: ','s');
R2 = input('Input the string 2: ','s');
R3 = input('Input the string 3: ','s');
R4 = input('Input the string 4: ','s');
K = simplify(expand(((R1*H1) + (R2*H2) + (R3*H3) + (R4*H4))/(R1 + R2 + R3 + R4)));
What I want to do is that user has to enter either y, b, n or q for each of the R1, R2, R3 and R4. Then R1 to R4 are then defined as a string, and they are called in the equation K. The equation K will be derived based on what the R1 to R4 are, which could be either y, b, n or q, since y, b, n and q were defined beforehand.
However, MATLAB gave me error. Could somebody help me please?
Thank you very much