How can I input variables to dsolve?
Ältere Kommentare anzeigen
I'm writing a function using dsolve, and earlier in the function I request input from the user at the keyboard, and save this input to the variable "A". When using dsolve, I cite the variable "A", but dsolve's solution leaves in the letter A instead of replacing it with the numerical answer the user provides. How can I fix this? Below is my code. I've tried using syms but I'm not sure how to make it work.
A=input('Enter the initial amount of the parent:');
Q=dsolve('DQ=(-1)*L*Q','Q(0)=A','t')
%The output is: Q = A/exp(L*t)
%I want A to take on the value that the user enters at the keyboard (for example, 7). Please help!
Antworten (1)
Walter Roberson
am 23 Feb. 2013
subs(Q, 'A', A)
Kategorien
Mehr zu Get Started with MATLAB finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!