i have an error using plot function with syms engine

1 view (last 30 days)
arvind thakur
arvind thakur on 20 Sep 2021
Answered: VBBV on 22 Sep 2021
I have an error like below,
Error using plot
Data must be numeric, datetime, duration or an array convertible to double.
Error in pressuremodel (line 36)
plot(a,K1,'.-b');
my code is:
%% pressure at crack wake due to bridgindg after application of remote stress
clc
close all
clear
a=0.001:0.0002:0.0018;
syms x a w
%x=1.0:0.1:1.98;
Ef=427000*10^6; % in Pa
Em=89000*10^6;
Ec=184000*10^6;
%mu=0.2825;
%v=0.36;
ao=0.001;
w=0.00512;
%R=.0725;
S=198*10^6;
%tow=20;
m1=0.6147+17.1844*(a.^2./w^2)+8.7822*(a.^6./w^6);
m2=0.2502+3.2889*(a.^2./w^2)+70.0444*(a.^6./w^6);
H=(1+m1*((a-x)./a)+m2*((a-x)./a).^2);
c=S*((w./(w-ao))+6*w*ao*((0.5*(w-ao)-(x-ao))./(w-ao)^3));
j=int((S*H)./(sqrt(a-x)), [0 ao]);
L=int(((S-c)*H)./(sqrt(a-x)), [ao a]);
K=sqrt(2/3.14)*(j+L);
K1=((K*(Em./(Ec)))./10^7);
plot(a,K1,'.-b');
help can appreciated in advance

Answers (2)

KSSV
KSSV on 20 Sep 2021
You need to substitue the value of a into K1 using the function subs, convers the output into double and then plot.
y = double(subs(K1,1)) ;
  1 Comment
arvind thakur
arvind thakur on 20 Sep 2021
It's again showing same error , could you plz revise and paste the above code sir, I am very new on matlab

Sign in to comment.


VBBV
VBBV on 22 Sep 2021
clc
close all
clear
a=0.001:0.0002:0.0018;
syms x a w
%x=1.0:0.1:1.98;
Ef=427000*10^6; % in Pa
Em=89000*10^6;
Ec=184000*10^6;
%mu=0.2825;
%v=0.36;
ao=0.001;
w=0.00512;
%R=.0725;
S=198*10^6;
%tow=20;
m1=0.6147+17.1844*(a.^2./w^2)+8.7822*(a.^6./w^6);
m2=0.2502+3.2889*(a.^2./w^2)+70.0444*(a.^6./w^6);
H=(1+m1*((a-x)./a)+m2*((a-x)./a).^2);
c=S*((w./(w-ao))+6*w*ao*((0.5*(w-ao)-(x-ao))./(w-ao)^3));
j=int((S*H)./(sqrt(a-x)), [0 ao]);
L=int(((S-c)*H)./(sqrt(a-x)), [ao a]);
K=sqrt(2/3.14)*(j+L);
K1=((K*(Em./(Ec)))./10^7);
y = double(subs(K1,a,0.001:0.0002:0.0018))
y = 1×5
0.7249 0.3595 0.2535 0.1861 0.1375
a = 0.001:0.0002:0.0018;
plot(a,y,'.-b');
Use the subs as @KSSV told

Community Treasure Hunt

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

Start Hunting!