Storing the output of spap2 into an array then looping and graphing that output
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Basically I have a matrix of data that I am trying to curve fit. I am using the spap2 function. Since I have an array of data that I am looping through and for each iteration I am trying to store the output of spap2 into an array so that I can graph that array later on in another loop.
The problem can be split into two parts: 1) Storing the output of spap2 into an array. 2) Looping through the array with the spap2 functions and graphing each iteration (with a 0.5 seconds pause between each graph) to produce a "dynamic graph" that changes with time!
Your help is greatly appreciated.
Sample of code I am using is below:
for counter = 1:limit
curv = curvature(counter,:); % Curvature of this iterations
moment = curv.*(E*I);
LOC = -flip(locations);
Ycurv = flip(curv);
Ymoment = flip(moment);
W = flip(w);
sp = spap2(1, k , LOC, Ycurv , W);
sp2 = spap2 (1, k , LOC , Ymoment, W);
theta = fnint(sp);
deflectionarray(counter,1) = fnint(theta);
momentarray(counter,1) = sp2;
shear = fnder(sp2);
soilrctnarray(counter,1) = fnder(shear);
end
3 commentaires
Réponses (1)
Unai San Miguel
le 29 Sep 2016
The output of spap2 is a struct, something like:
>>sp
sp =
form: 'B-'
knots: [1x25 double]
...
Maybe this is not what you would like to use in a dynamic plot. You could instead use fnplt(sp) in every step, or pts = fnplt(sp); plot(pts(1,:), pts(2,:)), ...
0 commentaires
Voir également
Catégories
En savoir plus sur Transmitters and Receivers dans Help Center et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!