Why doesn't my plot turn out the way it should?

I have been stuck at this for hours and i can't figure out what's the issue. Would be glad if anyone here can enlighten me!
clc
clear
%creating matrices for Solid-State Rate and Integral Expressions for Different Reaction Models
syms a t
M = [2*a^(1/2), 3*a^(2/3), 4*a^(3/4)];
K = 1./M;
I = int(K);
%making alpha the subject of the equation
eqn(1) = (I(1) == t);
v_a = solve(eqn(1), a);
%plotting alpha against time
t = linspace(0,10,1000);
fplot(t, v_a);
xlabel('t');
ylabel('f(x)');
title('Plot of the f(x)');
So is my code and the issue is that i can't get the shape of the plot out right. The expression for v_a is correct, but the plot isn't. Help!!

2 commentaires

Kevin Chng
Kevin Chng le 7 Oct 2018
Modifié(e) : Kevin Chng le 7 Oct 2018
Hi,
i'm not sure whether i can help you or not.
clc
clear all
%creating matrices for Solid-State Rate and Integral Expressions for Different Reaction Models
syms a t
M = [2*a^(1/2), 3*a^(2/3), 4*a^(3/4)];
K = 1./M;
I = int(K);
%making alpha the subject of the equation
eqn(1) = (I(1) == t);
v_a = solve(eqn(1), a);
%plotting alpha against time
% t = linspace(0,10,1000);
fplot(v_a,[0 10]);
xlabel('t');
ylabel('f(x)');
title('Plot of the f(x)');
Is it the shape you want? I guess you might confuse to use fplot.
cubehz94
cubehz94 le 7 Oct 2018
IT WORKS!!! Thank you. I do not understand how does this syntax work though

Connectez-vous pour commenter.

 Réponse acceptée

Hi
clc
clear all
%creating matrices for Solid-State Rate and Integral Expressions for Different Reaction Models
syms a t
M = [2*a^(1/2), 3*a^(2/3), 4*a^(3/4)];
K = 1./M;
I = int(K);
%making alpha the subject of the equation
eqn(1) = (I(1) == t);
v_a = solve(eqn(1), a);
%plotting alpha against time
% t = linspace(0,10,1000);
fplot(v_a,[0 10]);
xlabel('t');
ylabel('f(x)');
title('Plot of the f(x)');
I repost my solution here again as it works for you. You may refer to documentation https://www.mathworks.com/help/matlab/ref/fplot.html

Plus de réponses (0)

Catégories

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by