Plot symbolic functions for different domain

Hi all
i have a cell array where each element F{i} is a symbolic function of the variable x. I would like to plot these functions on their domain. Each domain is contained in a cell array X (due to the fact that each function has a different domain). How can i do that? I have tried with no success:
for i=1:length(F)
figure(1);set(gcf,'Visible', 'on')
plot(X{i},F{i})
xlabel('X')
ylabel('F')
hold on
end
Thank you for the help
Regards

1 件のコメント

EldaEbrithil
EldaEbrithil 2020 年 10 月 15 日
Maybe converting X domain cell arrays to a symbolic array might be the solution
Symbolic_array_domain= cell2sym(X);
but obviously the grouping of each domain is lost

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

 採用された回答

Ameer Hamza
Ameer Hamza 2020 年 10 月 15 日

0 投票

For symbolic variables, use fplot and pass the interval as second input. Try following
for i=1:length(F)
figure(1);set(gcf,'Visible', 'on')
fplot(F{i}, X{i})
xlabel('X')
ylabel('F')
hold on
end

6 件のコメント

EldaEbrithil
EldaEbrithil 2020 年 10 月 15 日
編集済み: EldaEbrithil 2020 年 10 月 15 日
Hi Ameer thank you for reply
it gives me this error:
Error using char
Cell elements must be character arrays.
Error in fplot (line 144)
strArgs = char(args{k});
Ameer Hamza
Ameer Hamza 2020 年 10 月 15 日
At which line? What is the complete error message?
EldaEbrithil
EldaEbrithil 2020 年 10 月 15 日
F has this form:
X has this form:
Ameer Hamza
Ameer Hamza 2020 年 10 月 15 日
X is a nested cell array. What is inside those cells? If these are limits them try this
fplot(F{i}, X{i}{1})
EldaEbrithil
EldaEbrithil 2020 年 10 月 15 日
Oh yes now it works!! Thank you very much Ameer!!
Ameer Hamza
Ameer Hamza 2020 年 10 月 15 日
I am glad to be of help!

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

その他の回答 (0 件)

カテゴリ

質問済み:

2020 年 10 月 15 日

コメント済み:

2020 年 10 月 15 日

Community Treasure Hunt

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

Start Hunting!

Translated by