How to return an array to single value?

13 Ansichten (letzte 30 Tage)
MUNKHBOLOR BAIGALI
MUNKHBOLOR BAIGALI am 11 Sep. 2020
Hello, I want to return from array to single values.
This code's result is P calculated at each x values with matrix -----------> But I want to calculate P at each x value with single values. How do I do?
help me please!!
function [Tc, P] = myfunc()
Ppv_rated = 250 ;
G = [5.75, 6, 6.365, 6.5, 6.185, 5.75, 5, 4.8, 5.5, 6.18, 6.15, 5.8 ];
Gref = 1000 ;
Kt = -0.485 ;
Tref = 25 ;
x = [0, 2, 5, 7, 8, 9, 10];
Tamb = [25.63, 26.7, 26.610, 25.46, 24.9, 24.01, 23.16, 23.01, 23.54, 23.78, 24.45, 25.3 ];
Tc = Tamb + (0.0256 * G ) ;
P = ((Ppv_rated * x) .* ((G/Gref).*(1 + Kt*(Tc - Tref )))')';
disp(P)
end
This code result get matrix.

Antworten (1)

Asad (Mehrzad) Khoddam
Asad (Mehrzad) Khoddam am 11 Sep. 2020
The size of x is different from G and Tamb
  2 Kommentare
MUNKHBOLOR BAIGALI
MUNKHBOLOR BAIGALI am 11 Sep. 2020
Yes sir. But I mean
for example:
x1 = 0
P1 = Ppv_rated * x1 * (G1/Gref) * (1 + Kt * (Tc1 -Tref))
P2 = Ppv_rated * x1 * (G2/Gref) * (1 + Kt * (Tc2 -Tref))
...
...
P12 = Ppv_rated * x1 * (G12/Gref) * (1 + Kt * (Tc12 -Tref))
x2 = 2
P1 = Ppv_rated * x2 * (G1/Gref) * (1 + Kt * (Tc1 -Tref))
P2 = Ppv_rated * x2 * (G2/Gref) * (1 + Kt * (Tc2 -Tref))
...
...
P12 = Ppv_rated * x2 * (G12/Gref) * (1 + Kt * (Tc12 -Tref))
...
...
x7 = 10
P1 = Ppv_rated * x7 * (G1/Gref) * (1 + Kt * (Tc1 -Tref))
P2 = Ppv_rated * x7 * (G2/Gref) * (1 + Kt * (Tc2 -Tref))
...
...
P12 = Ppv_rated * x7 * (G12/Gref) * (1 + Kt * (Tc12 -Tref))
I want to calculate like this example. but I don't know how to write the code
Asad (Mehrzad) Khoddam
Asad (Mehrzad) Khoddam am 11 Sep. 2020
So, each row of P in your code is for a value of x
P(1,:)
is the results for x=0
...
P(12,:)
is the rsults for x=10
The general row values is:
P(row,:)
row can be from 1 to 7

Melden Sie sich an, um zu kommentieren.

Produkte


Version

R2018b

Community Treasure Hunt

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

Start Hunting!

Translated by