<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Graphing/vectors with 'if' statements in Mathcad</title>
    <link>https://www.ptcusercommunity.com/t5/Mathcad/Graphing-vectors-with-if-statements/m-p/355932#M139196</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Just trying to familiarise myself with MathCAD, and start the process of converting from Excel...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As a practice problem, I'm trying to graph a functions which involves an 'if' statement: tractive effort (force) determined either by a maximum (limiting) value, or by dividing the available power by speed, whichever gives the lower value.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In Excel I'd use a 'min()' function at each point, but this isn't going to work in MathCAD because it will look at the whole of my speed vector (for plotting) and find the single minimum value.&amp;nbsp; Therefore I'm using an 'if - otherwise' statement to define my function for tractive effort.&amp;nbsp; This works for any individual speed value, including a single index of my speed vector, but won't accept the full vector to generate a graph.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;At least the units seem to be behaving themselves!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="TEvsSpeed.png" class="jive-image image-1" src="https://community.ptc.com/legacyfs/online/98757_TEvsSpeed.png" style="height: auto;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How &lt;STRONG&gt;should&lt;/STRONG&gt; I be approaching this?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 03 May 2018 14:39:07 GMT</pubDate>
    <dc:creator>JonathanHodgson</dc:creator>
    <dc:date>2018-05-03T14:39:07Z</dc:date>
    <item>
      <title>Graphing/vectors with 'if' statements</title>
      <link>https://www.ptcusercommunity.com/t5/Mathcad/Graphing-vectors-with-if-statements/m-p/355932#M139196</link>
      <description>Just trying to familiarise myself with MathCAD, and start the process of converting from Excel...As a practice problem, I'm trying to graph a functions which involves an 'if' statement: tractive effort (force) determined either by a maximum (limiting) value, or by dividing</description>
      <pubDate>Thu, 03 May 2018 14:39:07 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Mathcad/Graphing-vectors-with-if-statements/m-p/355932#M139196</guid>
      <dc:creator>JonathanHodgson</dc:creator>
      <dc:date>2018-05-03T14:39:07Z</dc:date>
    </item>
    <item>
      <title>Re: Graphing/vectors with 'if' statements</title>
      <link>https://www.ptcusercommunity.com/t5/Mathcad/Graphing-vectors-with-if-statements/m-p/355933#M139197</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;IMG __jive_id="98766" class="jive-image image-1" src="https://community.ptc.com/legacyfs/online/98766_pastedImage_0.png" style="max-height: 900px; max-width: 1200px;" /&gt;&lt;/P&gt;&lt;P&gt;Or with a plot&lt;/P&gt;&lt;P&gt;&lt;IMG class="jive-image image-2" src="https://community.ptc.com/legacyfs/online/98767_pastedImage_0.png" style="max-height: 900px; max-width: 1200px;" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Mar 2016 10:28:11 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Mathcad/Graphing-vectors-with-if-statements/m-p/355933#M139197</guid>
      <dc:creator>ValeryOchkov</dc:creator>
      <dc:date>2016-03-02T10:28:11Z</dc:date>
    </item>
    <item>
      <title>Re: Graphing/vectors with 'if' statements</title>
      <link>https://www.ptcusercommunity.com/t5/Mathcad/Graphing-vectors-with-if-statements/m-p/355934#M139198</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You have to use vecorization when you call TE(speed). EDIT: As Valery just showed while I was typing &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;&lt;P&gt;The vectorize operator is on the matrix palette. You should get TE(vectorize) with an arrow over it.&lt;/P&gt;&lt;P&gt;That way every single value is fed in your function and the results are collected in a vector.&lt;/P&gt;&lt;P&gt;The way you did it you fed TE with a vector, So in your function TE the argument v is a vector, and so P/v is a vector, too (Mathcad uses automatic vectorization here). You can't compare a vector with a constant TEmax and so you get the error.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BTW, you don't need any ranges, vectors etc. if you simply want to plot the function - don't think Excel, welcome to Mathcad!&lt;/P&gt;&lt;P&gt;It would have been a good idea to attach your worksheet.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WE&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Mar 2016 10:32:33 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Mathcad/Graphing-vectors-with-if-statements/m-p/355934#M139198</guid>
      <dc:creator>Werner_E</dc:creator>
      <dc:date>2016-03-02T10:32:33Z</dc:date>
    </item>
    <item>
      <title>Re: Graphing/vectors with 'if' statements</title>
      <link>https://www.ptcusercommunity.com/t5/Mathcad/Graphing-vectors-with-if-statements/m-p/355935#M139199</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;An alternative approach is to generalize the upper threshold function (if you feel you might use it again), and use a local function inside it to deal with the vectorization.&amp;nbsp; You can just use it with a vector or scalar as you see fit.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="jive-image image-1" src="https://community.ptc.com/legacyfs/online/98777_pastedImage_1.png" style="max-width: 1200px; max-height: 900px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Stuart&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Mar 2016 10:57:19 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Mathcad/Graphing-vectors-with-if-statements/m-p/355935#M139199</guid>
      <dc:creator>StuartBruff</dc:creator>
      <dc:date>2016-03-02T10:57:19Z</dc:date>
    </item>
    <item>
      <title>Re: Graphing/vectors with 'if' statements</title>
      <link>https://www.ptcusercommunity.com/t5/Mathcad/Graphing-vectors-with-if-statements/m-p/355936#M139200</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Werner and Valery!&amp;nbsp; It was the implicit / automatic vectorization in some cases that caught me out - it worked for other cases (such as aerodynamic drag) but not this one.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;From Valery's screenshot I've noticed the alternative approach, to vectorize the result using my range variable i as a subscript - I can see that both methods work, both for displaying a result vector and for defining the graph.&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;
&lt;P&gt;Werner Exinger wrote:&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;BTW, you don't need any ranges, vectors etc. if you simply want to plot the function - don't think Excel, welcome to Mathcad!&lt;/P&gt;

&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;Unless I'm missing something, that only works if I want the function plotted between -10 and +10 - how do I change the graph range without using range variables or vectors?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Updated worksheet attached, although I realise that at least the three of you have recreated it already.&amp;nbsp; It doesn't really go anywhere as I'm just using this to practice using MathCAD.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Mar 2016 11:17:23 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Mathcad/Graphing-vectors-with-if-statements/m-p/355936#M139200</guid>
      <dc:creator>JonathanHodgson</dc:creator>
      <dc:date>2016-03-02T11:17:23Z</dc:date>
    </item>
    <item>
      <title>Re: Graphing/vectors with 'if' statements</title>
      <link>https://www.ptcusercommunity.com/t5/Mathcad/Graphing-vectors-with-if-statements/m-p/355937#M139201</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks Stuart - I'm going to have to think about that some more... &lt;IMG src="https://community.ptc.com/legacyfs/online/emoticons/happy.png" /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Mar 2016 11:17:57 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Mathcad/Graphing-vectors-with-if-statements/m-p/355937#M139201</guid>
      <dc:creator>JonathanHodgson</dc:creator>
      <dc:date>2016-03-02T11:17:57Z</dc:date>
    </item>
    <item>
      <title>Re: Graphing/vectors with 'if' statements</title>
      <link>https://www.ptcusercommunity.com/t5/Mathcad/Graphing-vectors-with-if-statements/m-p/355938#M139202</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD&gt;
&lt;P&gt;Jonathan Hodgson wrote:&lt;/P&gt;
&lt;P&gt;&lt;/P&gt;
&lt;P&gt;Unless I'm missing something, that only works if I want the function plotted between -10 and +10 - how do I change the graph range without using range variables or vectors?&lt;/P&gt;
&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Click on the x axis.&amp;nbsp;&amp;nbsp; You should see the default values of -10 and 10.&amp;nbsp; Just type over the values with the range that you want.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-10 to 10 (default)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;replaced with 0 to 90&lt;IMG alt="" class="jive-image image-2" src="https://community.ptc.com/legacyfs/online/98779_pastedImage_2.png" style="max-width: 1200px; max-height: 900px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG alt="" class="jive-image image-1" src="https://community.ptc.com/legacyfs/online/98778_pastedImage_1.png" style="max-width: 1200px; max-height: 900px;" /&gt;&lt;/P&gt;&lt;P&gt;You can also do the same thing with the y axis (if needed)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Stuart&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Mar 2016 11:25:22 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Mathcad/Graphing-vectors-with-if-statements/m-p/355938#M139202</guid>
      <dc:creator>StuartBruff</dc:creator>
      <dc:date>2016-03-02T11:25:22Z</dc:date>
    </item>
    <item>
      <title>Re: Graphing/vectors with 'if' statements</title>
      <link>https://www.ptcusercommunity.com/t5/Mathcad/Graphing-vectors-with-if-statements/m-p/355939#M139203</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks - I'd tried that but hadn't realised that I need to click on the duplicate values that it suddenly displays, not on the actual axis labels (which would have seemed perfectly logical...).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Good, now some of this is starting to make sense! - although I'm still trying to get the hang of where I click, and when it decides to replace the existing text versus adding to it.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Mar 2016 11:29:40 GMT</pubDate>
      <guid>https://www.ptcusercommunity.com/t5/Mathcad/Graphing-vectors-with-if-statements/m-p/355939#M139203</guid>
      <dc:creator>JonathanHodgson</dc:creator>
      <dc:date>2016-03-02T11:29:40Z</dc:date>
    </item>
  </channel>
</rss>

