Error: Conversion to double from sym is not possible.

조회 수: 1 (최근 30일)
Aisha F Colindres
Aisha F Colindres 2017년 11월 26일
답변: Karan Gill 2017년 11월 27일
I created a code to plot x versus a range of T as follows but keep getting the error "Conversion to double from sym is not possible. None of my attempts to fix this has worked, any help would be appreciated.
clc;clear all
V=3785.4; %dm^3
Kco=3;
z=2902.14;
dHrx=-25000; %cal/mol
R=1.987; %cal/mol*K
To=300; %K
T=300:320;
E=15000; %cal/mol
y=exp((E/R)*((1/To)-(1./T)));
Kc=Kco*(exp((dHrx/R)*((1/To)-(1./T))));
syms x V z y Kc
eqn=V-((z./y).*(x./(((1-x).^2)-((1./Kc)*(x.^2))))) == 0;
solx=solve(eqn,x)
plot(x,T)

답변 (1개)

Karan Gill
Karan Gill 2017년 11월 27일
To plot symbolic expressions, use fplot instead of plot. See https://www.mathworks.com/help/symbolic/fplot.html .
Also, why are you plotting "x" against "t"? I assume you want to plot "solx".

카테고리

Help CenterFile Exchange에서 Conversion Between Symbolic and Numeric에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by