Getting Error: Data must be numeric, datetime, duration or an array convertible to double.
Show older comments
As a preface I lack a clear understanding of Matlab.
Here is my code:
%% Case 2) Non-Homogenous
close all;clear;clc
t=linspace(0,1,10);
i11=exp(0.5*t).*(cosh(sqrt(14.75)*t)-(3.5/sqrt(14.75))*sinh(sqrt(14.75)*t));
i12=(exp(0.5*t)/sqrt(14.75)).*sinh(sqrt(14.75)*t);
i21=(3*exp(0.5*t)/sqrt(14.75)).*sinh(sqrt(14.75)*t);
i22=(exp(0.5*t)).*(cosh(sqrt(14.75)*t)+(3.5/sqrt(14.75))*sinh(sqrt(14.75)*t));
M1=[i11 i12;i21 i22];
x0=[2;1];
p1=M1.*x0;
%% Symbolic Integration Examples (Problem 2)
syms tau
j11=exp(0.5*(t-tau)).*(cosh(sqrt(14.75)*(t-tau))-(3.5/sqrt(14.75))*sinh(sqrt(14.75)*(t-tau)));
j12=(exp(0.5*(t-tau))/sqrt(14.75)).*sinh(sqrt(14.75)*(t-tau));
j21=(3*exp(0.5*(t-tau))/sqrt(14.75)).*sinh(sqrt(14.75)*(t-tau));
j22=(exp(0.5*(t-tau))).*(cosh(sqrt(14.75)*(t-tau))+(3.5/sqrt(14.75))*sinh(sqrt(14.75)*(t-tau)));
p11=int(j11,tau);
p12=int(j12,tau);
p21=int(j21,tau);
p22=int(j22,tau);
M2=[p11 p12;p21 p22];
b=[4;2];
p2=M2.*b;
%%
x=p1+p2;
y=([1 2]*x)+6;
plot(t,y)
Any help provided is much appreciated.
Answers (1)
KSSV
on 24 Apr 2019
0 votes
YOu see t is double and y is of class sym. y has variable tau YOu have two options.
- Convert y into double by substituting possilbe values of tau using subs and double; and use plot.
- Or use ezplot or fplot.
1 Comment
Steven Reif
on 24 Apr 2019
Categories
Find more on Mathematics 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!