How can i coda this process?

1 vue (au cours des 30 derniers jours)
Muhendisleksi
Muhendisleksi le 1 Avr 2017
Commenté : Muhendisleksi le 1 Avr 2017
x=((0*-0.15)+(-7.50*-1.25)+(-9.50*-1.40)+(-5.81*-1.32)+(2.15*-1.28)+(10.20*-0.15)+(7.50*0))
%
h=((0*-7.50)+(-0.15*-9.50)+(-1.25*-5.81)+(-1.40*2.15)+(-1.32*10.20)+(-1.28*7.50)+(-0.15*0))
%
2*F=x-h
How can i coda this process?
  4 commentaires
John D'Errico
John D'Errico le 1 Avr 2017
Ok. So you wrote it. What is the problem?
Muhendisleksi
Muhendisleksi le 1 Avr 2017
The problem is I write a lot of ridiculous code.
clear
clc
% 1. Alan verileri
ust=[0;-0.15;-1.25; -1.40; -1.32; -1.28; -0.15;0];
alt=[0;-7.50; -9.50; -5.81; 2.15; 10.20;7.50;0];
% 2. Alan verileri
ust2=[0;-0.15;-1.27;-1.22;-1.36;-1.12;-1.23;-0.15;0];
alt2=[0;-7.50;-9.75;-6.05;1.95;6.74;10.12;7.50;0];
s=20;
% Alan heseplamaları
[u]=size(ust);
m=u-1;
for i=1:m
for j=1:m
F(i)=ust(i+1)*alt(i);
end
end
for i=1:m
for j=1:m
F1(i)=ust(i)*alt(i+1);
end
end
for i=1:m
for j=1:m
f(i)=ust2(i+1)*alt2(i);
end
end
for i=1:m
for j=1:m
f1(i)=ust2(i)*alt2(i+1);
end
end
Alan_1=(sum(F)-sum(F1))/2
Alan_2=(sum(f)-sum(f1))/2
I think a better code can be written.

Connectez-vous pour commenter.

Réponses (0)

Catégories

En savoir plus sur Logical dans Help Center et File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by