Unable to perform assignment because the left and right sides have a different number of elements.

1 次查看(过去 30 天)
clear all
close all
clc
t=[0:0.5:20];
ip=zeros(12,22)
q=0.25;
Vp=0.25;
p0=0.25;
S=0.25;
alpha=0.25;
d=0.25;
dabs=0.25;
t_p=0.25;
for n=1:length(ip)
ip(n)=(q*Vp*p0*S)/(alpha*d)*(exp(-alpha*Vp*(t-t_p))-exp(-alpha*dabs));
ipp=ip(n);
ipf=fft(ipp);
end

回答(1 个)

Image Analyst
Image Analyst 2022-11-10
Watch:
clear all
close all
clc
t=[0:0.5:20];
ip=zeros(12,22)
ip = 12×22
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
q=0.25;
Vp=0.25;
p0=0.25;
S=0.25;
alpha=0.25;
d=0.25;
dabs=0.25;
t_p=0.25;
for n=1:length(ip)
thisTerm = (q*Vp*p0*S)/(alpha*d)*(exp(-alpha*Vp*(t-t_p))-exp(-alpha*dabs))
whos thisTerm
ip(n)= thisTerm;
ipp=ip(n);
ipf=fft(ipp);
end
thisTerm = 1×41
0.0048 0.0028 0.0009 -0.0009 -0.0027 -0.0044 -0.0061 -0.0077 -0.0093 -0.0108 -0.0123 -0.0137 -0.0151 -0.0164 -0.0177 -0.0190 -0.0202 -0.0214 -0.0225 -0.0237 -0.0247 -0.0258 -0.0268 -0.0278 -0.0287 -0.0296 -0.0305 -0.0314 -0.0322 -0.0331
Name Size Bytes Class Attributes thisTerm 1x41 328 double
Unable to perform assignment because the left and right sides have a different number of elements.
You can't fit 41 numbers into a slot meant for 1. Perhaps you meant this:
clear all
close all
clc
t=[0:0.5:20];
ip=zeros(12,22)
q=0.25;
Vp=0.25;
p0=0.25;
S=0.25;
alpha=0.25;
d=0.25;
dabs=0.25;
t_p=0.25;
for n = 1 : length(t)
this_t = t(n);
thisTerm = (q*Vp*p0*S)/(alpha*d)*(exp(-alpha*Vp*(this_t-t_p))-exp(-alpha*dabs));
ip(n)= thisTerm;
ipp=ip(n);
ipf=fft(ipp);
end

类别

Help CenterFile Exchange 中查找有关 MATLAB Report Generator 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by