Storing the output of spap2 into an array then looping and graphing that output

조회 수: 2 (최근 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
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,:)), ...

카테고리

Help CenterFile Exchange에서 Graph and Network Algorithms에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by