Error in sym (line 268) S.s = tomupad(x); Error in untit2121led (line 33) An=simplify(sym(strrep(char(An), ‘sin (pi*n)’,’O’))); Related documentation
a parece este error en el codigo:
clc
clear all
close all
syms t n
A=[0 1 2];
f=[t -t+2];
t=sym(f);
T=max(A)-min(A);
wo=2*pi/T;
Ao=0;
for i=1:length (f)
Ao=Ao+int(f(i), ‘t’,A(i),A(i+1));
end
Ao=simplify(Ao/(T));
An=0;
for i=i:length (f)
An=An+int(f(i) *cos(n*wo*t), A(i),A(i+1));
end
An=simplify(2*An/T);
Bn=0;
for i=1:length (f)
Bn=Bn+int(f(i) *sin(n*wo*t), A(i),A(i+1));
end
Bn=simplify(2*Bn/T);
An=char(An);
Bn=char(Bn);
An=simplify(sym(strrep(char(An), ‘sin (pi*n)’,’O’)));
Bn=simplify(sym(atrrep(char(Bn), ‘sin (pi*n)’,’O’)));
An=simplify(sym(strrep(char(An), ‘cos (pi*n)’, ‘(-1)^O’)));
Bn=simplify(sym(strrep(char(Bn), ‘cos (pi*n)’, ‘(-1)^O’)));
An=simplify(sym(strrep(char(An), ‘sin (2*pi*n)’,’O’)));
Bn=simplify(sym(strrep(char(Bn), ‘sin (2*pi*n)’,’O’)));
An=simplify(sym(strrep(char(An), ‘sin (2*pi*n)’,’1′)));
Bn=simplify(sym(strrep(char(Bn), ‘sin (2*pi*n)’,’1′)));
disp(‘Ao’)
pretty(An)
disp(‘An’)
pretty(Bn)
disp(‘Bn’)
pretty(Bn)
x=linspace(min(A), max(A),1000);
fx=0;
for i=1:length(A)-1
if nod (i,2)==1
fx=fx+((x>=A(i)) & (x<=A(i+1))).*subs(f(i),x);
else
fx=fx+((x>A(i)) & (x<A(i+1))).*subs(f(i),x);
end
end
plot(x,fx,’Linewidth’,2); hold on
plot(x+max(x)-min(x),fx,’Linewidth’,2)
plot(x-max(x)+min(x),fx,’Linewidth’,2)
plot([max(x) max(x)] ,[fx(i) fx(end)],’Linewidth’,2)
plot([min(x) min(x)] ,[fx(end) fx(i)],’Linewidth’,2)
grid ona parece este error en el codigo:
clc
clear all
close all
syms t n
A=[0 1 2];
f=[t -t+2];
t=sym(f);
T=max(A)-min(A);
wo=2*pi/T;
Ao=0;
for i=1:length (f)
Ao=Ao+int(f(i), ‘t’,A(i),A(i+1));
end
Ao=simplify(Ao/(T));
An=0;
for i=i:length (f)
An=An+int(f(i) *cos(n*wo*t), A(i),A(i+1));
end
An=simplify(2*An/T);
Bn=0;
for i=1:length (f)
Bn=Bn+int(f(i) *sin(n*wo*t), A(i),A(i+1));
end
Bn=simplify(2*Bn/T);
An=char(An);
Bn=char(Bn);
An=simplify(sym(strrep(char(An), ‘sin (pi*n)’,’O’)));
Bn=simplify(sym(atrrep(char(Bn), ‘sin (pi*n)’,’O’)));
An=simplify(sym(strrep(char(An), ‘cos (pi*n)’, ‘(-1)^O’)));
Bn=simplify(sym(strrep(char(Bn), ‘cos (pi*n)’, ‘(-1)^O’)));
An=simplify(sym(strrep(char(An), ‘sin (2*pi*n)’,’O’)));
Bn=simplify(sym(strrep(char(Bn), ‘sin (2*pi*n)’,’O’)));
An=simplify(sym(strrep(char(An), ‘sin (2*pi*n)’,’1′)));
Bn=simplify(sym(strrep(char(Bn), ‘sin (2*pi*n)’,’1′)));
disp(‘Ao’)
pretty(An)
disp(‘An’)
pretty(Bn)
disp(‘Bn’)
pretty(Bn)
x=linspace(min(A), max(A),1000);
fx=0;
for i=1:length(A)-1
if nod (i,2)==1
fx=fx+((x>=A(i)) & (x<=A(i+1))).*subs(f(i),x);
else
fx=fx+((x>A(i)) & (x<A(i+1))).*subs(f(i),x);
end
end
plot(x,fx,’Linewidth’,2); hold on
plot(x+max(x)-min(x),fx,’Linewidth’,2)
plot(x-max(x)+min(x),fx,’Linewidth’,2)
plot([max(x) max(x)] ,[fx(i) fx(end)],’Linewidth’,2)
plot([min(x) min(x)] ,[fx(end) fx(i)],’Linewidth’,2)
grid on a parece este error en el codigo:
clc
clear all
close all
syms t n
A=[0 1 2];
f=[t -t+2];
t=sym(f);
T=max(A)-min(A);
wo=2*pi/T;
Ao=0;
for i=1:length (f)
Ao=Ao+int(f(i), ‘t’,A(i),A(i+1));
end
Ao=simplify(Ao/(T));
An=0;
for i=i:length (f)
An=An+int(f(i) *cos(n*wo*t), A(i),A(i+1));
end
An=simplify(2*An/T);
Bn=0;
for i=1:length (f)
Bn=Bn+int(f(i) *sin(n*wo*t), A(i),A(i+1));
end
Bn=simplify(2*Bn/T);
An=char(An);
Bn=char(Bn);
An=simplify(sym(strrep(char(An), ‘sin (pi*n)’,’O’)));
Bn=simplify(sym(atrrep(char(Bn), ‘sin (pi*n)’,’O’)));
An=simplify(sym(strrep(char(An), ‘cos (pi*n)’, ‘(-1)^O’)));
Bn=simplify(sym(strrep(char(Bn), ‘cos (pi*n)’, ‘(-1)^O’)));
An=simplify(sym(strrep(char(An), ‘sin (2*pi*n)’,’O’)));
Bn=simplify(sym(strrep(char(Bn), ‘sin (2*pi*n)’,’O’)));
An=simplify(sym(strrep(char(An), ‘sin (2*pi*n)’,’1′)));
Bn=simplify(sym(strrep(char(Bn), ‘sin (2*pi*n)’,’1′)));
disp(‘Ao’)
pretty(An)
disp(‘An’)
pretty(Bn)
disp(‘Bn’)
pretty(Bn)
x=linspace(min(A), max(A),1000);
fx=0;
for i=1:length(A)-1
if nod (i,2)==1
fx=fx+((x>=A(i)) & (x<=A(i+1))).*subs(f(i),x);
else
fx=fx+((x>A(i)) & (x<A(i+1))).*subs(f(i),x);
end
end
plot(x,fx,’Linewidth’,2); hold on
plot(x+max(x)-min(x),fx,’Linewidth’,2)
plot(x-max(x)+min(x),fx,’Linewidth’,2)
plot([max(x) max(x)] ,[fx(i) fx(end)],’Linewidth’,2)
plot([min(x) min(x)] ,[fx(end) fx(i)],’Linewidth’,2)
grid on error, s.s = tomupad(x) MATLAB Answers — New Questions