Subscripted assignment dimension mismatch.
Afficher commentaires plus anciens
Hi everyone. I'm new to MATLAB. What i am trying to do with this code is to plot the sum of the n values vs t that has 0.005 time step but i couldnt figure it out and whatever i try i get an subscripted assignment dimension match in l,ne 26(surface(2,k)=n+surface(2,k);). Also i want to see all the results for each variable i created, anybody has suggestions for that too? Here is my code;
clear
clc
d=0.4;
A=0.15;
B=1.6;
fo=0.0005;
e=((2*pi)*rand(1,50)); %epsilon
count=1;
for i=1:50;
for t=0:0.005:300;
f=(1.1^(i-1))*fo; %fi
T=1/f; %ti
k=2*pi/(dispersion(T,d)); %ki
h=0.5*(1+((2*k*d)/sinh(2*k*d))); %ni
ph=(1/(2*h))*(tanh(k*d))^2; %fi
a=abs((0.2*f*(0.205*(A^2)*(B^-4)*(f^-5)*exp(-0.75*(B*(f^-4))*ph)))^0.5); %ai
Ur(count)=2*a*(dispersion(T,d))^2/d^3; %Ursell Number
n(count+1)=a*cos((2*pi*f*t)+e(i)); %n(t)
count=count+1;
end
end
for k=1:3000050;
surface(2,k)=0;
for i=1:50;
surface(1,k)=t;
surface(2,k)=n+surface(2,k);
end
end
plot(surface(1,:),surface(2,:))
1 commentaire
madhan ravi
le 30 Oct 2018
What’s dispersion?
Réponse acceptée
Plus de réponses (1)
Catégories
En savoir plus sur Creating and Concatenating Matrices dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!