Plot symbolic functions for different domain

조회 수: 4 (최근 30일)
EldaEbrithil
EldaEbrithil 2020년 10월 15일
댓글: Ameer Hamza 2020년 10월 15일
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일
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일
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개)

카테고리

Help CenterFile Exchange에서 Tables에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by