Combine 4 graphs into 1

1 回表示 (過去 30 日間)
Francesco Tegazzini
Francesco Tegazzini 2018 年 10 月 13 日
コメント済み: madhan ravi 2018 年 10 月 13 日
To the Matlab Community.
For a university exam, I'm trying to create a code that allows me to plot in a single graph four functions (in four different variables) with different domains.
The resulting graph of the four functions combined, for how the functions are defined, should present, in the jump points between the variables, a continuity. Unfortunately, I do not see a result like that.
In the attached file, there are the functions and the variables. For clarifying:
  1. v1(x1), with 0<x1<value(1)
  2. v2(x2), with value(1)<x2<value(2)
  3. v3(x3), value(2)<x3<value(3)
  4. v4(x4), value(3)<x4<value(4)
What I would like to get is a graph of the function v1, v2, v3, v4 as functions of the same parameter x, with 0<x<value(4).
Thanks in advance for the help.
  2 件のコメント
jonas
jonas 2018 年 10 月 13 日
I don't really understand your question. Can you upload a sketch of your desired graph?
Francesco Tegazzini
Francesco Tegazzini 2018 年 10 月 13 日
Thank you for your interest in my question ... I've just managed to figure out where I was wrong.
In imposing the boundary conditions for the creation of the 4 functions, I applied the boundary conditions considering as if there were 4 distinct functions.
It is obvious that then the functions, when I tried to merge them into a single chart, turned out to be not continuous.

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

採用された回答

madhan ravi
madhan ravi 2018 年 10 月 13 日
編集済み: madhan ravi 2018 年 10 月 13 日
just alter it as mentioned below:(see attached screenshot)
figure
plot(x1,v1(x1),'Color','r','LineWidth',2)
hold on
plot(x2,v2(x2),'Color','g','LineWidth',2)
plot(x3,v3(x3),'Color','b','LineWidth',2)
plot(x4,v4(x4),'Color','y','LineWidth',2)
  2 件のコメント
Francesco Tegazzini
Francesco Tegazzini 2018 年 10 月 13 日
Thank you for your interest in my question ... I've just managed to figure out where I was wrong.
In imposing the boundary conditions for the creation of the 4 functions, I applied the boundary conditions considering as if there were 4 distinct functions.
It is obvious that then the functions, when I tried to merge them into a single chart, turned out to be not continuous.
madhan ravi
madhan ravi 2018 年 10 月 13 日
You’re welcome good that you found out the reason

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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGraph and Network Algorithms についてさらに検索

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by