Line graph help required.

I'm using Matlab for academic purposes to create a series of line graphs to display a set of x and y data and I have a couple of questions about Matlab that I would really appreciate if someone could clear up for me.
1. I replicated the ode23tx.m file and was wondering how the file marks each plot point with a circle (I have included a screenshot of this if I have not described it properly.)
2. Is there any way of ignoring the solution presented and show the error graph instead?
Thanks

3 件のコメント

dpb
dpb 2013 年 10 月 23 日
Not sure what you are trying to indicate w/ the 'x'; there are a few variants of ode23 but none of specifically 'tx'. Perhaps that's a name you gave to the replicated copy? Even if so, what's the point of replicating it instead of just using the distributed one appropriate for the problem at hand?
As for the plots, odeXX doesn't plot anything--that's done afterwards with the [T,Y] vectors as per your choices.
One adds markers, line types and colors thru the linestyle triplet in plot -- three one-letter mnemonics for color, marker, line (any of which can be omitted) or use set to modify the various line properties directly.
It's not clear what you're really asking here...
Kyle
Kyle 2013 年 10 月 23 日
編集済み: Kyle 2013 年 10 月 23 日
Ah sorry I should have explained, basically I changed the T value to X and left the Y the same. I just didn't understand how each plot point was circled on the graph output.
dpb
dpb 2013 年 10 月 23 日
I'm thinking you've got a misconception on what [T,Y] are/represent in the ode23x documentation (and the same concept applies throughout Matlab as well as virtually all procedural programming languages for that matter).
They're "dummy" arguments; what they are named is completely immaterial to the use of the routine -- they take internally the value of the variable passed to them.
If you're integrating over space instead of time, the routine doesn't care; call it with
[x,y] = ode23t(ODEFUN,[xo xend],y0);
and that you've got a range of x's in place of the documented TSPAN is totally immaterial -- inside the function the t's are the x values.

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

回答 (1 件)

Walter Roberson
Walter Roberson 2013 年 10 月 23 日

0 投票

The ode routines plot the result if you do not assign the output to a variable.
There are also various hooks in the options structure that can be used to plot various items. Kyle, you should have a look at odeset()

1 件のコメント

dpb
dpb 2013 年 10 月 23 日
Oh, good catch, Walter...I " never " use them w/o an output variable so forgot about the default behavior.
@Kyle...the actual question then is the circles on the lines comes from within odeplot with the following code snippet therefrom...
if ~ishold
ud.lines = plot(ud.t(1),ud.y(1,:),'-o');
hold on
ud.line = plot(ud.t(1),ud.y(1,:),'-o',EraseMode{:});
hold off
set(TARGET_AXIS,'XLim',[min(t) max(t)]);
else
ud.lines = plot(ud.t(1),ud.y(1,:),'-o',EraseMode{:});
ud.line = plot(ud.t(1),ud.y(1,:),'-o',EraseMode{:});
end
The 'o' on the '-o' is the culprit responsible...

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

カテゴリ

ヘルプ センター および File ExchangeMathematics についてさらに検索

質問済み:

2013 年 10 月 23 日

コメント済み:

dpb
2013 年 10 月 23 日

Community Treasure Hunt

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

Start Hunting!

Translated by