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

2 ビュー (過去 30 日間)
Moustafa El-sawy
Moustafa El-sawy 2016 年 7 月 4 日
回答済み: Unai San Miguel 2016 年 9 月 29 日
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 件のコメント
Moustafa El-sawy
Moustafa El-sawy 2016 年 7 月 5 日
Its one of the curvefitting functions.

サインインしてコメントする。

回答 (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 Center および File ExchangeGraph and Network Algorithms についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by