Storing the output of spap2 into an array then looping and graphing that output
1 次查看(过去 30 天)
显示 更早的评论
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 个评论
回答(1 个)
Unai San Miguel
2016-9-29
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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Graph and Network Algorithms 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!