differentiating a function and filling in values from excel
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
hello
Below I wanted to do the following. Calculate the first derivative and second derivative of a function. Next fill in the values of a,b,c and d with values from an excel table for each row.
My problem is that I can generate the f,df and d2f function using the diff formula. Also I can fill in the values for a,b,c and d using the subs formula for f. This doesn't seem to work for df and d2f. If i use subs the returning formulas for f and d2f are the same: f as many times there are rows in excel for each row in f. (in my case 10 times 10)
How can I use .*,.^,./ operators on df and d2f?
% analytical deriving f, df and d2f
t=sym('t');
a=sym('a');
b=sym('b');
c=sym('c');
d=sym('d');
f=a.*t.^3+b.*t.^2+c.*t+d
df=diff(f,t,1)
d2f=diff(f,t,2)
% import excelfile to replace variables
ar=xlsread('test0','A:A');
br=xlsread('test0','B:B');
cr=xlsread('test0','C:C');
dr=xlsread('test0','D:D');
f=subs(f,{a,b,c,d},{ar,br,cr,dr})
df=subs(f,{a,b,c,d},{ar,br,cr,dr})
d2f=subs(f,{a,b,c,d},{ar,br,cr,dr})
% obtain the AH,T1,T2,V1,V2,H1,H2
0 commentaires
Réponses (0)
Voir également
Catégories
En savoir plus sur Spreadsheets dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!