Clear Filters
Clear Filters

Attempting to hand variables off between equations but MATLAB isn't using vpasolve right?

1 view (last 30 days)
So I basically have a deformation equation xtundamped(t) and another deformation xtliftoff(t) that happens when xtundamped(t) reaches the lift-off deformation (dlift, also known as xm here). I need it to take the time, deformation and velocity and turn them into tm,x,v, respectively. However, it isn't calculating tm right as it thinks it should be 0.000099323919, but according to prior theory it should be around 0.00004 seconds. During this time it runs xtliftoff(t) until it goes back below xm or dlift. My question is specifically about tm because I don't want to ask y'all to do all the work haha. Here's the code so far:
eta = 0.1;
xi = 0.0625;
m = 162./32;
fo = 2.259.*10.^7;
alph = 35000;
kb = 1.33.*10.^9;
km = 6.893*10^9;
xb = 0.0762;
sy = 1020000000;
dy = 0.000385;
spre = 600*10.^6;
xm = xb+(3.768.*10.^-13*spre);
xe = ((kb.*xb) + (km.*xm))/(kb + km);
dlift = (3.768.*10.^-13.*spre);
w = sqrt((kb+km)./m);
bigw = sqrt(kb./m);
z = 0.0625;
% variables are assigned beforehand for full equation evaluation
syms t
xtundamped(t) = ((fo./m).*((exp(-alph.*t))/(alph.^2+w.^2)+((sin(w.*t-atan(w./alph)))./(w.*sqrt(alph.^2+w.^2)))))+(((kb.*xb+km.*xm)./m)*((1-cos(w.*t))/w.^2))+(xe.*cos(w.*t)) ;
fplot((xtundamped(t)-xb),[0 0.0009])
hold on
yline(dlift,"--r",'Lift-off')
tm = vpasolve((xtundamped(t)-xb)==dlift,t,[0 0.0001])
%x = xtundamped(t==tm);
v = diff(xtundamped(t),t);
%syms xtliftoff(t)
%xtliftoff(t) = xb + ((xm-xb).*cos(bigw.*(t-tm)))+((v./bigw)*sin(bigw.*(t-tm)))+(fo./m).*exp(-alph*tm)*((exp(-alph*(t-tm))/(alph^2+bigw^2))+(sin(bigw*(t-tm)-atan(bigw/alph))/(bigw*(alph^2+bigw^2))));
%y(x) = piecewise(x<xm,xtundamped(t), x>=xm,xtliftoff(t));

Answers (1)

Nipun
Nipun on 24 Jan 2024
Hi Albert,
I understand that the value of "tm" returned by "vpasolve" differs from the expected value. SInce I am not aware of the literature from where you have evaluated the actual value of "tm", I assume that the shared code requires some modifications based on initial conditions and function calls.
According to the given information and the shared code, I suspect the culprit for the deviation of calculated "tm" from the expected value might be the initial guess and search interval. The search interval [0, 0.0001] may be too restrictive for "vpasolve" and not properly centered around "tm". Consider relaxing the interval.
In case you are still not getting the expected value of "tm", consider the following:
  1. Plot the function: Plot the function xtundamped(t) - xb over a wider range to visually inspect where it crosses the dlift line. This can help you choose a better search interval for vpasolve.
  2. Multiple roots: If xtundamped(t) - xb crosses dlift multiple times, ensure that you are finding the correct crossing. If needed, use multiple calls to vpasolve with different intervals to find all crossings.
  3. Analytical check: Verify your equations analytically to ensure they are correct and that the expected behavior is consistent with the theory.
Hope this helps.
Regards,
Nipun

Tags

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!