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

1 Ansicht (letzte 30 Tage)
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

Antworten (1)

Image Analyst
Image Analyst am 10 Nov. 2022
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

Kategorien

Mehr zu MATLAB finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by