Differentiate big symbolic function
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Pavel
am 3 Apr. 2014
Kommentiert: Walter Roberson
am 4 Apr. 2014
I have this code:
if true
clear all
clc
% a=alpha1; b=alpha2; c=betha
syms a b c N1 N2 N3 N21 N31 n2 n21 n3 l1 l2 l3 P L sa
% Se calculeaza lungimea elementelor
P=2000;
L=1300;
sa=150;
l1=L/cos(a);
l2=L/cos(b);
l3=L/cos(b+c);
% Se calculeaza A
N21=(-P*cos(b+c)/(cos(b)*sin(b+c)-cos(b+c)));
N31=P/(sin(b+c)-cos(b+c)/cos(b));
n31=(-sin(a)*cos(b)-sin(b)*cos(a))/(sin(b+c)*cos(b)-cos(b+c)*sin(b));
n3=n31;
n21=(cos(a)-n3*cos(b+c))/cos(b);
n2=n21;
%efortul din elementul 1
N1=(-((n2*l2*N21+n3*l3*N31)/(l1+n2^2*l2*n3^2*l3)));
%efortul din elementul 3
N3=(P*cos(b)-N1*sin(a)*cos(b)-N1*cos(a))/(cos(b)*(sin(b+c)-cos(b+c)));
%efortul din elementul 2
N2=(N1*cos(a)-cos(b+c)*N3)/(cos(b));
%definirea functiei obiectiv
V1=simple((N1/sa)*l1+(N2/sa)*l2+(N3/sa)*l3);
V=diff(V1(a,b,c),a)
end
I want to diferentiate V1 with respect to a, b and c but i get the following error:
" Error using sym/subsindex (line 1555) Indexing input must be numeric, logical or ':'.
Error in sym>privformat (line 2367) x = subsindex(x)+1;
Error in sym/subsref (line 1575) [inds{k},refs{k}] = privformat(inds{k});
Error in Derivare2 (line 29) diff_f=diff(V1(a,b,c),a) "
What can i do to solve this problem? Thank you
0 Kommentare
Akzeptierte Antwort
Walter Roberson
am 3 Apr. 2014
You want to differentiate V1 but you ask to differentiate V instead, and V is not defined.
4 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Numbers and Precision finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!