Error in plotting an equation given y data sets (y vs x)
Afficher commentaires plus anciens
Hello. I am having trouble plotting a curve y vs x, given y data set from 1 to 30 with an interval of 0.5, through a given equation of
y=52.4*T*((1./x)+(C./(x)^2)); where T and C are constants
The error I am getting is because of the 'sym' that I cannot seem to understand. Please see my code below. Hoping for some help and assistance here. Thank you so much.
syms y x
T=450;
sigma=58.7;
lambda=32.9;
sigma_n=32.3;
lambda_n=7.5;
A=8.314*lambda+sigma/2;
B=32.4*lambda_n+sigma_n/2;
C=sqrt(A*B)/(lambda*lambda_n);
y=[1:0.5:30];
n=(30-1)/0.5;
for i=1:(n+1)
y(i)=52.4*T*((1./x(i))+(C./(x(i))^2));
end
plot(x,y);
1 commentaire
KSSV
le 20 Sep 2021
Fist solve the equation for x and then substitue y and then plot.
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Conversion Between Symbolic and Numeric dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


