Hello I need somehelp for a school Project and the Teacher doesn't know either the Answer and how to write the Code:
I've tried something but I get some Errors like: Error using == and probably others that I haven't found
Can anyone Help me solve this as fast as posible? :D I get the Error where is with Bold
clear
clc
I=.05;
t0=0;
tf=.2;
v0=[0 4.367*10^(-5) 4*10^6 0 .00389];
% tic;[t,v]=ode45(@Program11,[t0 tf],v0,.0000000000001,1);toc
tic;[t,v]=ode45(@Program11,[t0 tf],v0);toc
%set(gcf,'position',[100 100 800 550])
set(gcf,'position',[0 0 1100 800])
plot(t,v(:,1),'g');grid
title(['VITEZA VENTILULUI'])
xlabel('timp [s]');ylabel('viteza [m/s]');
figure(1)
plot(t,10.^(3).*v(:,2),'g');grid
title(['POZITIA VENTILULUI'])
xlabel('timp [s]');ylabel('pozitia [mm]');
figure(2)
plot(t,10.^(-5).*v(:,3),'g');grid
title(['PRESIUNEA IN CAMERA "A" '])
xlabel('timp [s]');ylabel('presiunea [bar]');
figure(3)
plot(t,v(:,4),'g');grid
title(['VITEZA MOTORULUI'])
xlabel('timp [s]');ylabel('viteza [m/s]');
figure(4)
plot(t,10.^(3).*v(:,5),'g');grid
title(['POZITIA MOTORULUI'])
xlabel('timp [s]');ylabel('deplasare [mm]');
pause
close
w=max(size(t));
Vf=v(w,4);
K=Vf/I;
i=find(t>.1);
M=max(v(i,4));
iM=find(v(:,4)==M);
disp('Factorul de amplificare=');disp(K);
j=find(t>t(iM));
u=min(v(j,4));
iu=find(v(:,4)==u);
k=find(t>t(iu));
m=max(v(k,4));
im=find(v(:,4)==m);
A1=M-Vf;
A2=m-Vf;
T=t(im)-t(iM);
fr=1/T;
omega=2*pi*fr;
delta=(log(A1/A2))/(2*pi);
A=v(w,1);B=v(w,2);C=v(w,3);D=v(w,4);E=v(w,5);
disp('viteza ventil=');disp(A);
disp('pozitie ventil=');disp(B);
disp('presiune=');disp(C);
disp('viteza motor=');disp(D);
disp('pozitie motor=');disp(E);
disp('Frecventa proprie=');disp(fr);
disp('Factorul de amortizare=');disp(delta);
disp('OMEGA=');disp(omega);

5 commentaires

madhan ravi
madhan ravi le 15 Jan 2019
Program11 ? upload it
Adam
Adam le 15 Jan 2019
Please give an exact error message if you are getting an error. This should pinpoint it to 1 line as well as giving more information about what is going wrong.
Steven Lord
Steven Lord le 15 Jan 2019
What is the exact full text of the error message you receive (all the red text)? Don't paraphrase, don't summarize, copy and paste it here verbatim. The full message contains information that may help us determine the cause of the error.
Nuber Claudiu
Nuber Claudiu le 15 Jan 2019
Error using ==
Matrix dimensions must agree.
Error in Program333 (line 47)
im=find(v(:,4)==m);
TADA
TADA le 15 Jan 2019
The Error Message Says It All...
Put A Breakpoint In Line 47, run The Script Then Look At The Sizes Of v And m.
For This Comparison To Work m Should Be A Column Vector Of The Same Size As The Height Of Matrix v

Connectez-vous pour commenter.

 Réponse acceptée

Jan
Jan le 15 Jan 2019

0 votes

i = find(t > 0.1);
M = max(v(i, 4));
iM = find(v(:, 4) == M);
This fails if no t is greater than 0.1. Then i is empty and M also in consequence. Now:
find(v(:, 4) == [])
fails.
Use the debugger to check this. Type in the command window:
dbstop if error
and run the code again. When Matlab stops at the error, check the sizes of the used variables. If an empty M let the code stop, a check by if isempty(M) might solve the problem.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by