Commit ef40ad57 authored by P41842 (Petz Phillip)'s avatar P41842 (Petz Phillip) 💬
Browse files

Reverted Repo

parent 153fed5d
This is pdfTeX, Version 3.14159265-2.6-1.40.20 (MiKTeX 2.9.6960 64-bit) (preloaded format=pdflatex 2019.3.10) 13 MAR 2019 17:44
This is pdfTeX, Version 3.14159265-2.6-1.40.20 (MiKTeX 2.9.6960 64-bit) (preloaded format=pdflatex 2019.3.10) 13 MAR 2019 18:04
entering extended mode
**./main.tex
(main.tex
......
% Clear and close all
clear all;
close all;
clc;
% Import csv data
M = csvread('../Testdata/SineAndCosine.csv');
addpath('../../Source/matlab2tikz/src/');
% Modify imported data
t = M(:,1);
sinSig = M(:,2);
cosSig = M(:,3);
% Delete M variable
clear M;
% Plotting the signal y over time t
plot(t,sinSig); hold on; % Plot multiple lines
plot(t,cosSig); hold off; % Plot new lines
% Set the figure parameters
legend('Sinus','Cosinus'); % Label both datasets with names
grid minor; % Set a fine datagrid
grid on; % Set a coarse datagrid
xlabel('time (s)'); % Label x axis
ylabel('amplitude'); % Label y axis
title('Sine and cosine, calculated with \pi');
matlab2tikz('../LaTeX/Figures/MatlabSineAndCosine.tex', 'showInfo', false, 'width', '\figurewidth', 'height', '\figureheight');
%matlab2tikz('../LaTeX/Figures/LatexFigure.tex', 'standalone', true);
clear all;
close all;
clc;
% Load Data from file
File = 'Wetter';
City = 'Hagenberg';
addpath('../Testdata');
% For tikz
addpath('../../Source/matlab2tikz/src/');
Weatherdata = ImportWeatherdata([File City '.csv']);
fig = figure;
numElem = length(Weatherdata.Temperature2mabovegnd);
timevect = [1:numElem];
plot(timevect, Weatherdata.Temperature2mabovegnd);
title([File ' ' City]);
grid on;grid minor;
% Mean temperature
meanTemp = mean(Weatherdata.Temperature2mabovegnd);
hold on; % Erweitern eines Plots
plot(timevect, meanTemp*ones(1,numElem), 'g*');
xlim([numElem-24 numElem]);
ylabel('Temperature [C^{\circ}]');
% Plot moving mean
movingMeanTemp = movmean(Weatherdata.Temperature2mabovegnd,24);
plot(timevect, movingMeanTemp);
legend('Temp [C^{\circ}]', 'Mean', 'Moving Mean');
% Store
saveas( fig, ['../LaTeX/Images/' File City], 'png' );
saveas(fig,['../LaTeX/Images/' File City '.svg'])
%matlab2tikz(['../LaTeX/Figures/' File City '.tex'], 'standalone', true);
matlab2tikz(['../LaTeX/Figures/Matlab' File City '.tex'], 'showInfo', false, 'width', '\figurewidth', 'height', '\figureheight');
% Plot Histogram
figure;
hist(Weatherdata.Temperature2mabovegnd);
title('Histogram')
ylabel('Hours');
xlabel('Temperature [C^{\circ}]');
grid on;
grid minor;
% Clear and Close all
clear all % Clear all existing variables
clc % Clear all command line outputs
close all % Close all existing windows
% Setting all relevant variables
f = 1; % Set frequency to x hertz
Amp = 1; % Set ampitude to 1
ts = 1/1000; % Set number of sample points
T = 1; % Set simulation time to 1 second
t = 0:ts:T-ts; % Create time vector
sinSig = Amp*sin(2*pi*f*t); % Create sine signal
cosSig = Amp*cos(2*pi*f*t); % Create cosine signal
% Plotting the signal y over time t
figure;
plot(t,sinSig); hold on; % Plot multiple lines
plot(t,cosSig); hold off; % Plot new lines
% Set the figure parameters
legend('Sinus','Cosinus'); % Label both datasets with names
grid minor; % Set a fine datagrid
grid on; % Set a coarse datagrid
xlabel('time (s)'); % Label x axis
ylabel('amplitude'); % Label y axis
title('Sine and cosine, calculated with \pi');
% Modify signals
sinSig = sinSig';
cosSig = cosSig';
t = t';
% Export csv data
csvwrite('../Testdata/SineAndCosine.csv', [t, sinSig, cosSig])
\ No newline at end of file
import numpy as np
import matplotlib.pyplot as plt
from matplotlib2tikz import save as tikz_save
# to move files
import shutil
def PlotWaves(Filename):
File = 'C:/Users/Phillip/Documents/mathessentials/Files/Testdata/' + Filename
data = np.genfromtxt(File, delimiter=',', skip_header=0, skip_footer=0, names=['Time', 'Sine', 'Cosine'])
fig = plt.figure()
ax1 = fig.add_subplot(111)
ax1.plot(data['Sine'], color='r', label='Sine')
ax1.plot(data['Cosine'], color='b', label='Cosine')
ax1.grid()
plt.title('Sine and Cosine')
plt.xlabel('Sample')
plt.ylabel('Amplitude')
plt.legend()
File = "Python" + Filename[:-4] + ".tex"
tikz_save(File, figureheight='\\figureheight', figurewidth='\\figurewidth')
Target = 'C:/Users/Phillip/Documents/mathessentials/Files/LaTeX/Figures/'
shutil.copy(File, Target)
plt.show()
def PlotTemperature(Filename):
File = 'C:/Users/Phillip/Documents/mathessentials/Files/Testdata/' + Filename
data = np.genfromtxt(File, delimiter=';', skip_header=12, skip_footer=0, names=['Year', 'Month', 'Day', 'Hour', 'Minute', 'Temperature'])
fig = plt.figure()
ax1 = fig.add_subplot(111)
ax1.plot(data['Temperature'], color='r', label='Temperature')
ax1.grid()
plt.title(Filename)
plt.xlabel('Sample')
plt.ylabel('Temperature')
plt.legend()
File = "Python" + Filename[:-4] + ".tex"
tikz_save(File, figureheight='\\figureheight', figurewidth='\\figurewidth')
Target = 'C:/Users/Phillip/Documents/mathessentials/Files/LaTeX/Figures/'
shutil.copy(File, Target)
plt.show()
PlotWaves('SineAndCosine.csv')
PlotTemperature('WetterHagenberg.csv')
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment