Clear Filters
Clear Filters

How to plot the graphs by fixing constants of your choice

2 views (last 30 days)
I have this expression as output
C1*exp(-x*(9/(4*(37/8 - 10^(1/2))^(1/3)) + (37/8 - 10^(1/2))^(1/3) + 3/2)) + C2*exp(x*(9/(8*(37/8 - 10^(1/2))^(1/3)) + (37/8 - 10^(1/2))^(1/3)/2 - 3/2))*cos((3^(1/2)*x*(9/(4*(37/8 - 10^(1/2))^(1/3)) - (37/8 - 10^(1/2))^(1/3)))/2) - C3*exp(x*(9/(8*(37/8 - 10^(1/2))^(1/3)) + (37/8 - 10^(1/2))^(1/3)/2 - 3/2))*sin((3^(1/2)*x*(9/(4*(37/8 - 10^(1/2))^(1/3)) - (37/8 - 10^(1/2))^(1/3)))/2)
How can i plot the graph by fixing constants of my choice

Accepted Answer

DGM
DGM on 24 May 2021
Edited: DGM on 24 May 2021
C = [1 2 3] % pick some constants
x = linspace(0,50,100); % pick an interval
y = C(1)*exp(-x*(9/(4*(37/8 - 10^(1/2))^(1/3)) + (37/8 - 10^(1/2))^(1/3) + 3/2)) ...
+ C(2)*exp(x*(9/(8*(37/8 - 10^(1/2))^(1/3)) + (37/8 - 10^(1/2))^(1/3)/2 - 3/2)) ...
.*cos((3^(1/2)*x*(9/(4*(37/8 - 10^(1/2))^(1/3)) - (37/8 - 10^(1/2))^(1/3)))/2) ...
- C(3)*exp(x*(9/(8*(37/8 - 10^(1/2))^(1/3)) + (37/8 - 10^(1/2))^(1/3)/2 - 3/2)) ...
.*sin((3^(1/2)*x*(9/(4*(37/8 - 10^(1/2))^(1/3)) - (37/8 - 10^(1/2))^(1/3)))/2);
plot(x,y)
or you could do the same thing using symbolic tools
syms x C1 C2 C3
y = C1*exp(-x*(9/(4*(37/8 - 10^(1/2))^(1/3)) + (37/8 - 10^(1/2))^(1/3) + 3/2)) ...
+ C2*exp(x*(9/(8*(37/8 - 10^(1/2))^(1/3)) + (37/8 - 10^(1/2))^(1/3)/2 - 3/2)) ...
*cos((3^(1/2)*x*(9/(4*(37/8 - 10^(1/2))^(1/3)) - (37/8 - 10^(1/2))^(1/3)))/2) ...
- C3*exp(x*(9/(8*(37/8 - 10^(1/2))^(1/3)) + (37/8 - 10^(1/2))^(1/3)/2 - 3/2)) ...
*sin((3^(1/2)*x*(9/(4*(37/8 - 10^(1/2))^(1/3)) - (37/8 - 10^(1/2))^(1/3)))/2);
y = subs(y,[C1 C2 C3],[1 2 3]); % specify the constants
fplot(y,[0 50]) % specify the interval

More Answers (1)

KSSV
KSSV on 24 May 2021
You can substitute your value using subs. Read about this function.
Also you can plot for range values using fplot. Read about it.

Categories

Find more on 2-D and 3-D Plots in Help Center and File Exchange

Tags

Products

Community Treasure Hunt

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

Start Hunting!