integral solver give a function as result

1 回表示 (過去 30 日間)
Gianluca Angelini
Gianluca Angelini 2023 年 11 月 13 日
回答済み: Ishu 2023 年 11 月 27 日
Hi everybody, I am trying to solve my code by using the integral solver of Matlab, since I need to guarantee an energetic equivalence between two graphs. But the result isn't satisfying. The thing is that I cannot understand what's going wrong.
this is the code:
Sig_Height=0.0213*(vel_wind_R^2);
T_zc=0.519*vel_wind_R;
AA=4*pi^3*(Sig_Height/(T_zc^2))^2;
BB=16*pi^3*(1/(T_zc)^4);
syms freq_wave;
Spectre=AA/(freq_wave^5)*exp(-BB/(freq_wave^4)); %Bretschneider's spectre
integral=int(Spectre/(1-2*freq_wave*cos(teta_1rad)/g),0,inf);
Spectre_e=double(integral);
integral_2=int(freq_wave-(freq_wave^2*vel_nave/g)*cos(teta_1rad),0,Inf);
freq_e=double(integral_2);
I specify that:
vel_wind_R= 6.7; teta_1rad= 1.04; g=9.81.
Thanks in advance to whoever will give me support.

採用された回答

Ishu
Ishu 2023 年 11 月 27 日
Hi Gianluca Angelini,
I understand that you are trying to solve the equations using "integral" but in the provided code you have not used the "intergral" of MATLAB anywhere.
I tried to reproduce the error at my end and I found that "double()" is not used properly. The functionality of "double()" is to convert symbolic values into doubles but as in the equations there is no value provided for "freq_wave" symbolic varible so it gives error. Therefore, before using "double()" you should use "subs()" to assign a symbolic value to "freq_wave" and then use "double()".
vel_wind_R= 6.7;
teta_1rad= 1.04;
g=9.81;
Sig_Height=0.0213*(vel_wind_R^2);
T_zc=0.519*vel_wind_R;
AA=4*pi^3*(Sig_Height/(T_zc^2))^2;
BB=16*pi^3*(1/(T_zc)^4);
syms freq_wave
Spectre=AA/(freq_wave^5)*exp(-BB/(freq_wave^4)); %Bretschneider's spectre
integral=Spectre/(1-2*freq_wave*cos(teta_1rad)/g);
Spectre_e=subs(integral, freq_wave, pi); % replace freq_wave with pi
Spectre_e2 = double(Spectre_e)
Spectre_e2 = 0.0036
You can refer below documentations for more information:
Hope it helps.

その他の回答 (0 件)

製品


リリース

R2018b

Community Treasure Hunt

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

Start Hunting!