Plot cells with variables?

조회 수: 3 (최근 30일)
Sa Moha
Sa Moha 2021년 12월 8일
답변: Awais Saeed 2021년 12월 9일
Hi guys
I want to plot cells of a matrix. For example;
syms x;
A=[0;1;0;1];
A=A*x^2+A;
plot(x,A(2,1))
But it returns error for me.
Error using plot
A numeric or double convertible argument is expected
Can you please help?
Thank you!

채택된 답변

Awais Saeed
Awais Saeed 2021년 12월 9일
I think you want to plot the symbolic expression x^2+1 (that's what A(2,1) gives you). If that's the case, use fplot()
syms x;
A = [0;1;0;1];
A = A*x^2+A
A = 
fplot(A(2,1)) % its default interval is [-5 5].
title('plot of X^2+1')
ylabel('x^2+1')

추가 답변 (0개)

카테고리

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

제품


릴리스

R2015a

Community Treasure Hunt

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

Start Hunting!

Translated by