Converting MATLAB to C++ Code Need Help

3 Ansichten (letzte 30 Tage)
Nimrod
Nimrod am 17 Jun. 2012
Is there any way to convert this MATLAB code into C++ in a simple way as possible? Thanks. I am trying to plot a three point running mean.
%Plotting T coordinates which represent the temperature
%in the vertical
clear all;
T=[22 24 16.2 8.4 -0.3 -7.3 -20.3 -37.1 -56.7];
H=[0 914 1876 3141 4267 5830 7530 9590 12280];
%Plotting H coordinates which represent the height
%in the vertical
%3 point running mean
Tmean = conv(T, ones(1,3)/3);
Tmean_valid = Tmean(3:end-2);
Hmean = conv(H,ones(1,3)/3);
Hmean_valid = Hmean(3:end-2);
figure(1);
plot(Tmean_valid,H(2:end-1), ':*r');
hold on
plot(T,H,':*g')
legend('Running Mean','Temperature Profile')
title('Temperature Running Mean as function of height')
xlabel('Temperature(C)')
ylabel('Height (m)')
  1 Kommentar
Walter Roberson
Walter Roberson am 17 Jun. 2012
C++ does not have the equivalent of "clear all", or of graphics.

Melden Sie sich an, um zu kommentieren.

Antworten (0)

Kategorien

Mehr zu Call C++ from MATLAB finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by