Hi i'm fairly new to MATLAB and encounter a problem regarding this equation y=c(x)^m
where m is the gradient of points:
(x,1y1)=(100,50)
(x2,y2)=(1000,10)
This is the eq i put on MATLAB:
Eq = log10(Y2) == log10(C1*X2^(m)); %Equation
C1 = vpasolve (Eq, C1)
It seems that i get C far from my hand-drawn answer
How to solve C?

 Accepted Answer

Looks okay to me.
format long g
X1 = 100; Y1 = 50;
X2 = 1000; Y2 = 10;
m = (Y2-Y1)./(X2-X1);
syms C1
Eq = log10(Y2) == log10(C1*X2^(m)); %Equation
C1sol = solve(Eq,C1)
C1sol = 
vpa(C1sol)
ans = 
13.593563908785257310765717430783
%log10(Y2) == log10(C1*X2^m) implies
%Y2 == C1*X2^m implies
C1_numeric = Y2/(X2^m)
C1_numeric =
13.5935639087853

4 Comments

Hi Walter, thank you so much for the feedback.
The answer for C given by the book is still way off, I'm not sure if it is wrong
or i misinterpret the question.
Any thoughts?
syms x1 x2 y1 y2
syms c m
eqn1 = y1 == c*x1^m
eqn2 = y2 == c*x2^m
eqn3 = y1/y2 == (c*x1^m)/(c*x2^m)
You should be able to proceed from here, as the above eliminates one of the variables, so re-arrange to solve the other variable.
quick question, on eqn3 wouldn't it just cross the c value off?
Yes, giving you an equation of the form A=B^m with known A and B, which you can use to find m easily.

Sign in to comment.

More Answers (0)

Categories

Find more on Functions in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!